How to stop a deployed docker stack?

孤者浪人 提交于 2019-12-04 17:23:27

问题


I just completed the beginners Docker tutorials and would like to know how to clean up.

I deployed a stack and with a few different service using the below command:

docker stack deploy --compose-file docker-stack.yml vote 

Is there away to stop all the containers associated with this stack, or do I have to stop them individually?

Thank you!


回答1:


You can remove a stack with:

docker stack rm vote

At present, this is still a detached operation that will take time to run in the background.


If for some reason you still want the stack and service definitions, you can scale the "replicated" services down to 0 replicas, and "global" services you can add a constraint that doesn't match any node.

docker service update --replicas 0 $service_name
docker service update --constraint-add no_such_node=true $service_name


来源:https://stackoverflow.com/questions/41838150/how-to-stop-a-deployed-docker-stack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!