Docker - docker restart stack service

by
Jeremy Canfield |
Updated: December 15 2021
| Docker articles
The docker stack ls command can be used to display the stacks. This command must be run from the swarm manager.
docker stack ls
Something like this should be returned.
NAME SERVICES ORCHESTRATOR
foo 3 Swarm
bar 1 Swarm
The docker stack services <stack name> command can be used to display the services in a stack.
docker stack services foo
Something like this should be returned.
ID NAME MODE REPLICAS IMAGE PORTS
ivq9h5yxl1om foo_service001 replicated 1/1 registry.example.com/foo_service001:latest
kod8l0fc9alv foo_service002 replicated 1/1 registry.example.com/foo_service001:latest *:8000->8000/tcp
l4frotyxwqzg foo_service003 replicated 0/1
The docker service update command can be used to restart a service in a stack.
~]# docker service update foo_service003
foo_service003
overall progress: 1 out of 1 tasks
1/1: running [==================================================>]
verify: Service converged
The --force flag can be used if the prior command fails to restart the service.
docker service update foo_service003 --force
Did you find this article helpful?
If so, consider buying me a coffee over at