如何禁用docker群模式?

How to disable docker swarm mode?

我已经启用 docker swarm 进行本地测试。现在,每当尝试使用 docker-compose up 进行部署时,我都会看到以下警告:

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.

如何禁用 docker 集群模式?

docker swarm leave 应该可以解决问题

docker swarm leave 用于工作节点离开 swarm ,而 docker swarm leave --force 用于管理节点离开 swarm。

如果docker swarm leavedocker swarm leave --force 不工作并且 return

 Error response from daemon: context deadline exceeded

您可以删除 /var/lib/docker/swarm 并重新启动服务.. 例如在 centos

systemctl restart docker

docker swarm leave --force

docker network prune

第一个命令停止 swarm,然后删除所有网络。这应该有效。