Docker swarm error after restart

Dear Master,

I have problem when rejoin Node:

[root@dockernode01 ~]# docker node ls
Error response from daemon: rpc error: code = Unknown desc = The swarm does not have a leader. It’s possible that too few managers are online. Make sure more than half of the managers are online.
[root@dockernode01 ~]# docker system info | grep -i swarm
Swarm: pending
Error: rpc error: code = Unknown desc = The swarm does not have a leader. It’s possible that too few managers are online. Make sure more than half of the managers are online.
[root@dockernode01 ~]# docker node update --availability ative dockernode01
Error response from daemon: rpc error: code = Unknown desc = The swarm does not have a leader. It’s possible that too few managers are online. Make sure more than half of the managers are online.

Please help How to resolve this problem.

Regards,

Henry

try docker swarm init --force-new-cluster will create new swarm with the same dataset so you don’t lose your services and all.

I was tried with that command, but no success. Everthing die. I will rebuild then capture that error to show.

Preventing

demote the node you are going to “switch off”/leave swarm

# find node id
$ docker node ls
ID                            HOSTNAME            STATUS    AVAILABILITY   MANAGER STATUS   ENGINE VERSION
o1iz67ehuenfzbyg2gjxayaee     hostA               Ready     Active         Reachable        20.10.6
fic857lrupfemxqie5rvq63yt *   hostB               Ready     Active         Leader           20.10.6

$ docker node demote o1iz67ehuenfzbyg2gjxayaee
Manager o1iz67ehuenfzbyg2gjxayaee demoted in the swarm.

# now on, the node can safely leave the swarm
$ docker swarm leave --force

Reacting

Restart if there are no healthy nodes.

Start >> stop Docker engine (NOT restart ) and init Swarm again. Validate firewall ruleset afterwards as Docker overwrites it.

$ systemctl stop docker
$ systemctl start docker

Drain left node if there is healthy manager node.

Reference docker info rpc error on manager node | Quis custodiet ipsos custodes?