When I run this Gitlab CI job on my own runner “myrunner”
test:
tags:
- myrunner
image: docker:latest
stage: build
services:
- docker:dind
script:
- echo "It works!"
rules:
- when: always
I get this error message:
Preparing the "docker" executor
Using Docker executor with image docker:latest ...
Starting service docker:dind ...
Pulling docker image docker:dind ...
ERROR: Preparation failed: Error response from daemon: toomanyrequests: You have reached your pull rate limit. You may increase the limit by authenticating and upgrading: https://www.docker.com/increase-rate-limit (docker.go:142:1s)
Will be retried in 3s ...
How can I authenticate before pulling the image docker:dind to avoid the pull rate limit on Dockerhub?
Steps to create own Gitlab runner:
Start runner:
docker run -d --name gitlab-runner --restart always \
-v /srv/gitlab-runner/config:/etc/gitlab-runner \
-v /var/run/docker.sock:/var/run/docker.sock \
gitlab/gitlab-runner:latest
Register:
docker run --rm -v /srv/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner register \
--non-interactive \
--executor "docker" \
--docker-image docker:stable \
--url "DOMAIN" \
--registration-token "REGISTRATION_TOKEN" \
--description "docker-runner" \
--tag-list "myrunner" \
--run-untagged="true" \
--locked="false" \
--access-level="not_protected" \
--docker-volumes "/certs/client" \
--docker-volumes /var/run/docker.sock:/var/run/docker.sock \
--docker-privileged
gitlab/dind is image that should be used to build projects with docker-based workflow. The image runs Docker Engine and includes Docker Compose which allows to use full docker toolkit from build script. docker pull gitlab/dind. © 2022 Docker Inc.
I added this to my gitlab-ci.yml
:
variables:
DOCKER_AUTH_CONFIG: '{ "auths": { "https://index.docker.io/v1/": { "auth": "$DOCKER_AUTH" } }}'
The value of $DOCKER_AUTH
can be generated with
echo -n "my_username:my_password" | base64
with the username/password for Dockerhub.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With