53

I have enabled docker swarm for local testing. Now, whenever trying to deploy using docker-compose up I see the following warning:

WARNING: The Docker Engine you're using is running in swarm mode.

Compose does not use swarm mode to deploy services to multiple nodes in a swarm. All containers will be scheduled on the current node.

To deploy your application across the swarm, use docker stack deploy.

How can I disable docker swarm mode?

FlavorScape
  • 13,301
  • 12
  • 75
  • 117
Datageek
  • 25,977
  • 6
  • 66
  • 70

4 Answers4

100

docker swarm leave is used when you want a worker node to leave from swarm , while docker swarm leave --force is for a manager node to leave the swarm.

Rohan Seth
  • 2,010
  • 1
  • 14
  • 13
  • I have a swarm with only one manager. I want to disable swarm mode because I don't need it and I have problem with nginx reverse proxy original client ip. So if I remove/disable the manager the containers will still works ? What happen to the network stacks and the internal ips (10.x.x.x.)? – Kreker Mar 09 '20 at 08:33
  • If you have one node as manager and want to down that, then your swarm will not be functional. If you have a stack running within that swarm, that will not be active. Better approach is to remove the stack first (I am referring to `docker stack`) and then disable/remove the swarm. – Muhammad Tariq Dec 17 '21 at 04:41
  • Your `docker stack` or services will automatically be deleted, once your manager is down OR your quorum is not maintained. Check Leave The Swarm section in the given link https://docs.docker.com/engine/swarm/manage-nodes/ – Muhammad Tariq Dec 17 '21 at 04:51
14

docker swarm leave should do the trick

samprog
  • 2,454
  • 1
  • 13
  • 18
2

docker swarm leave --force

docker network prune

1st command to stop the swarm and then remove all the networks. This should work.

1

If docker swarm leave and docker swarm leave --force do not working and return

 Error response from daemon: context deadline exceeded

you can remove /var/lib/docker/swarm and restart service.. for example in centos

systemctl restart docker
  • 2
    This might be "draconian advice" and should be considered only with great caution. If you actually do the `rm` command as suggested, you are effectively removing docker ... in a very clumsy way. – Mike Robinson Dec 18 '19 at 15:41
  • @MikeRobinson thank for comment! You are right, I have a mistake and fixed it. Do not use asterisk, only remove or move swarm directory – Nikita Shesterikov Dec 24 '19 at 07:40