Is it possible to do a force recreation of containers using compose file in docker swarm mode ? (I am aware of using HEALTHCHECK in Dockerfile)
Currently i have to remove the stack first & then deploy it again -
$ docker stack deploy -c stg-sm-deploy-compose.yml --with-registry-auth MY-APP
$ docker stack rm MY-APP
$ docker stack deploy -c stg-sm-deploy-compose.yml --with-registry-auth MY-APP
Is there any possibility that above 3 commands can be replaced by -
$ docker stack deploy -c stg-sm-deploy-compose.yml --with-registry-auth MY-APP --force-recreate
For any service created inside that stack that didn't change, you can use:
docker service update --force $service
which will force a rolling update of that service.
To recreate everything from a stack, enter your stack name as $stack in:
docker stack services -q $stack \
| while read service; do
docker service update --force $service
done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With