'Correct way to set up DOCKER_AUTH_CONFIG?
Hey I am trying to pull an image from a private artifactory repository .My gitlab-ci.yml file looks like below :
stages:
- run_script
run_script:
image : artifactory.bayer.com/artifactory/aie-docker-dev-mydockerrepo:latest
stage:
run_script
script:
- docker pull aie-docker-dev-mydockerrepo.artifactory.bayer.com/aie-docker-dev-mydockerrepo:latest
I have set up DOCKER_AUTH_CONFIG like below which I have added as CI Variable:
{
"auths": {
"aie-docker-dev-mydockerrepo.artifactory.****.com": {
"auth": "dXNlcm5hbWU6cGFzc3dvcmQ3535aCBzcGFjZXMgaW4gaXQK"
}
}
}
The auth part I have gotten from :
echo "username:password with spaces in it" | base64 through Git BASH .
I am getting below error :
WARNING: Failed to pull image with policy "if-not-present": Error response from daemon: unauthorized (manager.go:205:0s)
ERROR: Preparation failed: failed to pull image "artifactory.bayer.com/artifactory/aie-docker-dev-mydockerrepo:latest" with specified policies [if-not-present]: Error response from daemon: unauthorized (manager.go:205:0s)
Will be retried in 3s ...
ERROR: Job failed (system failure): failed to pull image "artifactory.bayer.com/artifactory/aie-docker-dev-mydockerrepo:latest" with specified policies [if-not-present]: Error response from daemon: unauthorized (manager.go:205:0s)
My question is whats the right way to configure DOCKER_AUTH_CONFIG ? And does this method work to pull private image ?
Solution 1:[1]
My guess will be that there is problem with new line within encoded stream or username/password have typos.
try to use right method from gitlab.com: https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#determine-your-docker_auth_config-data
I am using same authentication way and it works, also try to check if locally from docker login you are able to download that image, sometimes restrictions on level of access are not working correctly
Solution 2:[2]
It's aie-docker-dev-mydockerrepo.artifactory inside the auths file and in a different way in image: artifactory.bayer.com/artifactory
It should be aligned following the pattern:
image: registry.example.com:5000/namespace/image:tag
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | anynewscom |
| Solution 2 | Artem Ptushkin |
