How to login docker account in Gitlab-ci
Answer a question
I have subscribed for a Pro plan of docker account to increase rate limit in my self hosted Gitlab CI jobs. Then successfully logged-in using this command on the server:
$ sudo docker login -u user -p *******
This is my .gitlab-ci.yml file:
image: edbizarro/gitlab-ci-pipeline-php:7.3-alpine
unittest:
stage: testing
services:
- mysql:latest
script:
- ./vendor/bin/phpunit --colors --stop-on-failure
But when jobs get started, I'm still getting this error:
Running with gitlab-runner 13.6.0 (8fa89735)
on fafa-group-runner n7oiBzAk
Preparing the "docker" executor
30:53
Using Docker executor with image edbizarro/gitlab-ci-pipeline-php:7.3-alpine ...
Starting service mysql:latest ...
Pulling docker image mysql:latest ...
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:4s)
Am I missing something?
Answers
You performed the docker login as the root user on the host. However the images are being pulled by the GitLab runner, which will be another user, possibly containerized.
The instructions for configuring runner registry credentials has several options, including setting DOCKER_AUTH_CONFIG in either the project's .gitlab-ci.yml or runner's config.toml. That variable contains the content of the ~/.docker/config.json with the registry credentials inside.
更多推荐
所有评论(0)