Docker stack deploy is not updating existing containers

Viewed 976

I am deploying 4 containers using docker stack deploy as below:

docker stack deploy --compose-file compose.yml --with-registry-auth myapp

For the first time, the containers are built using the latest image on the registry, no problem.

But when I push new images to the registry and run the commands again, the containers are not rebuilt using the latest images.

I am using the latest tag in my images. I know it is not the recommended way to do things, but for what I have read in the documentation, docker stack deploy if using the latest tag, will check for image sha with the registry, if it is different the containers will rebuild using latest images, but In my case, it's not happening. Am I missing something here?

I also get an error/warning when I run docker stack deploy once the stack is already up:

Updating service service_name (id: some_hash_value)
image docker.pkg.github.com/username/repository/image-name:latest could not be accessed on a registry to record
its digest. Each node will access docker.pkg.github.com/username/repository/image-name:latest independently,
possibly leading to different nodes running different
versions of the image.
1 Answers

I encoutered the same error message when I started using a new docker registry. The new registry's SSL certificate was not considered secured by docker.

So I got this error until I added my new registry to the insecure-registries section of the /etc/docker/daemon.json

I've seen nobody mentionning this solution on this question or other similar ones, so I hoped this could help.

Related