问题:docker ---- It's possible that too few managers are online. Make sure more than half of the managers are online.  

背景:docker测试集群,为3台虚拟机,镜像全部拷贝自其它docker 虚拟机。 由于原先安装过swarm,先经过拷贝重启后在执行 dowker swarm XX  时报错。

 

解决:

 

1.每台先强制init :

  docker swarm init --force-new-cluster     (此时执行 docker node ls --将node信息删除,原因是这些node全部来自我拷贝的镜像中老旧的信息。)

2.然后此时选取 swarm worker节点加入到其中一台时:docker swarm join --token **** 

  报错Error response from daemon: This node is already part of a swarm. Use "docker swarm leave" to leave this swarm and join another one.

3.根据提示需要 docker swarm leave ,然后报错:

  Error response from daemon: You are attempting to leave the swarm on a node that is participating as a manager. Removing the last manager erases all current state of the swarm. Use `--force` to ignore this message.

4.根据提示:加上--force : docker swarm leave --force   然后再重新join即可

 

 

附:Server Version: 17.12.1-ce