Search code examples
dockergitlabcontinuous-integrationgitlab-cigitlab-ci-runner

GitLab Runner not using Registry Mirror


Since docker introduced the pull rate limit i'm running a pull-through registry. I have done the setup with the documentation on dockers site (https://docs.docker.com/registry/recipes/mirror/#configure-the-cache).

In my runners config.toml two volumes will be mounted, one for the docker socket and another one for the daemon.json.

But everytime i want to build something i get the following error message that i have reached my pull rate limit:

Running with gitlab-runner 13.11.0 (7f7a4bb0)


on srv-gitlab-ba5 vXWs_kze
Preparing the "docker" executor
00:25
Using Docker executor with image alpine:3.12 ...
WARNING: Pulling GitLab Runner helper image from Docker Hub. Helper image is migrating to registry.gitlab.com, for more information see https://docs.gitlab.com/runner/configuration/advanced-configuration.html#migrate-helper-image-to-registrygitlabcom
Pulling docker image gitlab/gitlab-runner-helper:x86_64-7f7a4bb0 ...
Using docker image sha256:25f27e06750273451a8211bbe80dc14f5d2bb389ff912ae0adffb477fa26058f for gitlab/gitlab-runner-helper:x86_64-7f7a4bb0 with digest gitlab/gitlab-runner-helper@sha256:20ff486a25738d42d2bca770092d2c4b1ae28881de3b599877ab954d3654a08a ...
Pulling docker image alpine:3.12 ...
WARNING: Failed to pull image with policy "always": toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit (manager.go:205:2s)
ERROR: Preparation failed: failed to pull image "alpine:3.12" with specified policies [always]: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit (manager.go:205:2s)
Will be retried in 3s ...

My config.toml for the runner looks like:

concurrent = 5
check_interval = 0

[session_server]
  session_timeout = 1800

[[runners]]
  name = "srv-gitlab-ba5"
  url = "***"
  token = "***"
  executor = "docker"
  [runners.cache]
    Type = "s3"
    Shared = true
    [runners.cache.s3]
      ServerAddress = "***"
      AccessKey = "***"
      SecretKey = "***"
      BucketName = "gitlab-cache"
      Insecure = false
  [runners.docker]
    tls_verify = false
    image = "docker:19.03.8"
    privileged = false
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/etc/docker:/etc/docker:ro", "/cache"]
    shm_size = 0

docker-compose.yml for the runner:

version: "3.7"
services:
  gitlab_runner:
    image: {self build image with config.toml above}
    restart: always
    container_name: gitlab-runner
    privileged: true
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /etc/docker:/etc/docker:ro

Can someone tell me if my configuration is correct or is it possible that i forgot something? I have googled a lot but didn't find the correct solution for my problem.


Solution

  • If you do not switch off instance runner very often, try to avoid using option "always"

    WARNING: Failed to pull image with policy "always"
    

    To switch this value, set up gitlab-runner registry with --docker-pull-policy "if-not-present" then docker will keep layers of images and will not pull it every time from docker registry, no clue then to create additional registry