简体   繁体   中英

What is opposite of docker swarm init?

With a single host with a swarm that has been created with init, the host gets networks created etc.

There appears to be no 'docker swarm destroy' or similar that purges the system back to a state before the swarm. I did a leave --force but that left networks.

Do you have to manually tidy up a bunch of things you don't know were created or is there an easy command to get back to a clean setup?

Thanks

docker swarm leave is the only command for reverting swarm membership. It cleans up all swarm specific artefacts that were created by docker stack deploy , eg overlay networks and secrets.

If you still got user defined networks after leaving the swarm, these were probably created by docker-compose . Note that this is not swarm specific, it can also happen in standalone mode.

You can get a listing of all networks that were created by docker-compose with

docker network ls --filter label=com.docker.compose.project

and get rid of them with

docker network rm $(docker network ls --filter label=com.docker.compose.project -q)

如果 docker 实例是管理器: docker swarm leave --force

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM