我正在尝试使用私有 Docker 注册表设置 gitlab 运行器服务。根据文档,设置 DOCKER_AUTH_CONFIG 环境变量并使用 docker auth 凭据填充它就足够了:
并发 = 2 check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "docker-shared-2"
url = "https://gitlab.easybell.de/"
token = "SDRWmUtpfVNb4c4xMicf"
executor = "docker"
environment = ["DOCKER_AUTH_CONFIG={ \"auths\": { \"xxxx\": { \"auth\": \"xxxx=\" } } }"]
[runners.docker]
tls_verify = false
privileged = true
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache"]
shm_size = 0
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
使用此配置,gitlab ci 作业仍然失败,并出现以下错误:
ERROR: Preparation failed: Error response from daemon: Get https://xxx: no basic auth credentials (executor_docker.go:168:0s)
除了使此设置正常工作之外,我还缺少什么或需要做什么?
与其
DOCKER_AUTH_CONFIG
在 gitlab 运行器配置中设置变量,不如为 docker 守护进程设置它:/etc/docker/config.json