I'm using docker swarm, and storing images in AWS ECR. I'm using auto-scaling, so instances go up and down all the time. When nodes start, they join the cluster and docker swarm deploys the container.
That works fine for a few hours after I create the service, then at some point docker stops deploying containers to the nodes until I manually go there and run docker swarm update --with-registry-auth myservice
. It deploys all the containers and works for a few more hours, then stops again.
I'm using aws ecr credential helper to login to the registry, and it has been working fine. But my guess is that docker is not updating the credentials automatically form time to time, as each token are only valid for a few hours.
What do I need to do to make docker swarm update the credentials automatically from time to time? I suppose I could run docker service update --with-registry-auth
on cron every hour, but I'm not sure if this is the right path.