Gurleen Sethi
Gurleen Sethi

Reputation: 3502

Docker stack deploy not pulling images from private resgistry even when using --with-registry-auth

I am deploying container using docker stack and docker-compose file using the following command

docker stack deploy --with-registry-auth -c compose.yml app

The initial deployment is successful, but when I re-run the command, I get the following error for containers:

Updating service sparkful_nginx (id: <some_id>)
image <image_url> could not be accessed on a registry to record
its digest. Each node will access <image_url> independently,
possibly leading to different nodes running different
versions of the image.

PS: I am using GitHub registry.

Upvotes: 3

Views: 3351

Answers (2)

igolka97
igolka97

Reputation: 298

I encountered the same problem and was able to solve it in a way that I haven't seen in any of the posts. Here it is:

I discovered that in the root/.docker/config.json file on the manager node, where all authorization data is stored, there is an invalid entry in addition to the one I need. Here is the file itself:

cat config.json 
{
    "auths": {
        "": {
            "auth": "Og=="
        },
        "registry.gitlab.com": {
            "auth": "<token>"
        }
    }
}

After I deleted the entire file and did docker login again, everything worked as expected. This invalid entry was probably created while I was trying to set up deployment using ansible.

Upvotes: 0

nischay goyal
nischay goyal

Reputation: 3480

You probably need to do docker login on each machine followed by

docker login -u username -p password registry.hub.Docker.com/myproject 
docker stack deploy -c Docker-swarm.yml test --with-registry-auth

as explained over here

Ref: http://littlebigextra.com/installing-docker-images-private-repositories-docker-swarm/

Update With Github Registry, it's a known issue open at the moment. https://github.com/containerd/containerd/issues/3291#issuecomment-579804848

Upvotes: 2

Related Questions