August 24, 2021

[SOLVED] local gitlab-runner exec docker with custom cntainer registry

 

In case your .gitlab-ci.yaml file has reference for custom docker registry and you get an error

ERROR: Preparation failed: failed to pull image "registry.example.io/foo/dev-base:22.0.2" with specified policies [always]: Error response from daemon: Get https://registry.example.io/v2/foo/dev-base/manifests/0.0.2: denied: access forbidden (manager.go:205:0s)



try to pass your auth key from ~/.docker/config.json file as follows. where AUTH_KEY is the key form this file for your domain 


gitlab-runner exec docker deploy:foo --env DOCKER_AUTH_CONFIG="{\"auths\":{\"registry.example.io\":{\"auth\":\"AUTH_KEY\"}}}"