Failure to connect node to docker
I would say it has to do with the firewall. Make sure your ports are configured correctly in the third field. From Docker Docs :
Open protocols and ports between hosts. The following ports must be accessible. On some systems, these ports are open by default.
TCP port 2377 for communication with cluster management TCP and UDP port 7946 for communication between nodes UDP port 4789 for overlay network traffic
source to share
From the official Docker swarm
The following ports should be open on your docker servers.
TCP port 2377 for cluster management communications
TCP and UDP port 7946 for communication among nodes
UDP port 4789 for overlay network traffic
To enable these ports, run the below command on all of your docker servers. kindly follow digitalocen article for full steps.
firewall-cmd --add-port=2376/tcp --permanent
firewall-cmd --add-port=2377/tcp --permanent
firewall-cmd --add-port=7946/tcp --permanent
firewall-cmd --add-port=7946/udp --permanent
firewall-cmd --add-port=4789/udp --permanent
source to share
As others have pointed out, closed ports may be one of the reasons. But I also found a couple more.
The latest version of Docker suffers from huge proxy issues:
- https://github.com/moby/moby/issues/34825
- https://github.com/moby/moby/issues/34996
- https://github.com/moby/moby/issues/35046
- https://github.com/moby/moby/issues/35395
According to this comment , the fix will "probably" turn it into a Docker version 17.11
, and it is "considered" to be fixed for 17.09
.
All my ports are open and the NO_PROXY
hack in the above links is not working.
I have tried all versions of Docker between 17.05
all the way up to 17.11.0-ce-rc3, build 5b4af4f
without any success, which led me to suspect that a recent Vagrant update (I am using 2.0.1
) and / or VirtualBox (using 5.1.30
) might be the culprit . Updating one of these two usually results in any random issues. But instead of downgrading these guys, I tried to update the Vagrant boxes I was running.
In my 2 machine installation, I switched the first node to fso/artful64-desktop
and the second node to fso/artful64
(both versions 2017-11-01
). To my surprise, this made Docker Swarm work on version 17.10.0-ce
and 17.11.0-ce-rc3, build 5b4af4f
. Please note the private network is broken on Vagrant 2.0.1
if you want to use Ubuntu 17.10 box lol (can be manually fixed ).
source to share
simpler than one of the official docs :
-
restart the swarm manager:
- clear the swarm with
docker swarm leave --force
- re-init with
docker swarm init --advertise-addr [ip of the machine, check it with 'docker-machine ls']:2377
(2377
is port for swarm pooling )
- clear the swarm with
-
then add the car to the swarm with
docker-machine ssh myvm2 "docker swarm join \ --token <token> \ <ip>:<port>"
source to share
The error message we ran into was not exactly the same, but very similar:
Error response from daemon: rpc error: code = Unavailable desc = grpc: connection unavailable
In our case, we added proxy settings for the docker daemon to get the docker node images from behind our corporate proxy. So when trying to connect to docker, join the worker manager, it went to the proxy instead.
Solution: Add swarm manager to NO_PROXY docker daemon environment variable and you're good to go. This answer tells you how.
source to share
Temporarily solved by flushing iptables , but that was a bad idea! After that, cloning the images didn't work because it didn't find a suitable docker iptables.
This is really a FW problem, but more precisely firewalld (centos7).
Solved the issue by allowing the appropriate ports via firewalld as stated by
@ sanjaykumar81's answer.
source to share
More information on this is available in the Docker Forum.
As other people have noted, adding an extra port to firewalld fixes the problem
sudo firewall-cmd --add-port=2376/tcp --permanent
sudo firewall-cmd --add-port=2377/tcp --permanent
sudo firewall-cmd --add-port=7946/tcp --permanent
sudo firewall-cmd --add-port=7946/udp --permanent
sudo firewall-cmd --add-port=4789/udp --permanent
source to share