Cleaning up

As with any service that we are finished with, we need to make sure that we clean up any resources we have used up so far. In the case of Swarm, we should probably remove our service and destroy our cluster until we need it again. You can do both of those things using docker service rm and docker swarm leave:

$ docker service ls
ID NAME MODE REPLICAS IMAGE PORTS
z0z90wgylcpf simple-server replicated 3/3 simple_server *:8000->8000/tcp

$ docker service rm simple-server
simple-server

$ docker service ls
ID NAME MODE REPLICAS IMAGE PORTS

$ docker swarm leave --force
Node left the swarm.
The reason why we had to use the --force flag here is due to the fact that we are a manager node and we are the last one in the cluster, so by default, Docker will prevent this action without it. In a multi-node setup, you will not generally need this flag.

With this action, we are now back at where we started and are ready to do this with a real service.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.118.14