Interestingly, when I run dockerd on the worker in the foreground, it does not have a problem joining the swarm. However, when started via “systemctl start docker” on centos, the worker is unable to join the swarm.
Temporary solved by flushing iptables, but was a bad idea!! After that, cloning images didn’t work because it didn’t find the appropriate iptables chain “docker”.
It is indeed a FW issue, but more precisely firewalld (centos7).
Solved the issue by allowing the appropriate ports through firewalld,:
I got the exact same error, and finally found out I was being too smart. Below is my output from the init command, so make sure you just copy the bold line. I was changing the ip address to another vm2.
$ docker-machine ssh myvm1 “docker swarm init --advertise-addr 192.168.99.101”
Swarm initialized: current node (o7egg259g3bjibx5cubiaiu5h) is now a manager.
To add a worker to this swarm, run the following command:
I was facing same issue .
I created 2 machines
centos-1 running docker - Version: 17.12.0-ce
centos-2 running docker - Version: 17.12.0-ce
i made centos-1 as master / manager node . I was trying to make centos-2 as worker node but it was failing with same error .
So i stopped the firewall with #iptables -F command and then restarted docker daemon by stsremctl restart docker .
Post which my problem was resolved and it
[root@centos2 ~]# docker swarm join --token SWMTKN-1-4026x0nvco9tkxk8zrxu9khal33g3mlhvgba1tfinl5i73yur1-7yihj163dq62sn8hhvw6iv6gr 192.168.56.105:2377
This node joined a swarm as a worker.