#Run the following on the worker node to leave the swarm. docker swarm leave Node left the swarm.
If the node has the Manager role, you will get a warning about maintaining the quorum of Managers. You can use --force to leave on the manager node:
#Manager Node docker swarm leave --force Node left the swarm.
Nodes that left the Swarm will still show up in
docker node ls output.
To remove nodes from the list:
docker node rm node-2 node-2