Service created by docker swarm cluster
docker service create –name test_web –mode global –publish mode=host,published=10002,target=80 nginx
Service is running normally. But I want to restart all the service containers. Docker service update test_web found
Try and find that it does restart:
#docker service update test_web
Since –detach=false was not specified, tasks will be updated in the background.
However, there is a problem that there will be a container with exit status on each node after restart.
c9d98b3700d9 nginx “/bin/sh -c ‘nginx” 10 minutes ago Exited (137) 8 minutes ago test_web.0xp4mew7v11z1gnwjvh7nzvyc.3wp0rft0qf8n3r9kfgfe71gm3
Is there any way to automatically delete these containers with exit status after the service is updated?
Or is there another way to restart the service container?
Write your own script to delete it. I can’t do anything right now.