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
Swarm mode has two types of services: replicated and global. For replicated services, you specify the number of replica tasks for the swarm manager to schedule onto available nodes.
By default Docker Swarm uses a default address pool 10.0. 0.0/8 for global scope (overlay) networks. Every network that does not have a subnet specified will have a subnet sequentially allocated from this pool.
Leave the swarmRun the docker swarm leave command on a node to remove it from the swarm. For example to leave the swarm on a worker node: $ docker swarm leave Node left the swarm. When a node leaves the swarm, the Docker Engine stops running in swarm mode.
docker swarm init generates two random tokens, a worker token and a manager token. When you join a new node to the swarm, the node joins as a worker or manager node based upon the token you pass to swarm join. After you create the swarm, you can display or rotate the token using swarm join-token.
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
, e.g. 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)
If the docker instance was a manager: docker swarm leave --force
.
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