Swarm init issue

Hi
I use the below command to init swarm on leader machine:

sudo docker swarm init --advertise-addr 172.19.187.96:2800 --listen-addr 172.19.187.96:2801
Swarm initialized: current node (d0xlmdxm6ew5xis1046yze7c6) is now a manager.

To add a worker to this swarm, run the following command:

docker swarm join \
--token SWMTKN-1-57yenz8gevqjr5voo8j58oswwbnojtoffdzd24p91kxbbrmxa3-arphlwto9tk9ncwj00nkv7l8h \
172.19.187.96:2800

Then, I follow the resulted commmand to make the node join in the network. But it failed:
sudo docker swarm join --token SWMTKN-1-57yenz8gevqjr5voo8j58oswwbnojtoffdzd24p91kxbbrmxa3-arphlwto9tk9ncwj00nkv7l8h 172.19.187.96:2800
Error response from daemon: rpc error: code = 14 desc = grpc: the connection is unavailable

if I changed the port from 2800 to 2801 in the command, it is OK.
sudo docker swarm join --token SWMTKN-1-57yenz8gevqjr5voo8j58oswwbnojtoffdzd24p91kxbbrmxa3-arphlwto9tk9ncwj00nkv7l8h 172.19.187.96:2801
This node joined a swarm as a worker.

I felt the strange that the swarm init command gave a result for node join it but user could not follow the result to do it.
BTW, I found there is no processes monitor the 2800 port at that time.

is the docker bug? could some guys give some suggestion?

Thanks.

some guys know this issue?

Hi,

I am having the same issue. I installed the main UCP on one machine but while trying to add a replica node to the cluster I am getting the error:

docker swarm join --token SWMTKN-1-38ktpioszt6156rdryztshyzbn5iqkvtmnmjj4la6i0v5m82pa-41n2sznls1ez0hc47a5a06f6n 10.211.x.x:2377
Error response from daemon: rpc error: code = 14 desc = grpc: the connection is unavailable.

Try to specify IP address only on both --advertise-addr and --listen-addr.

+1 some issue as yours

I meet the same problem, and solve this by changing the --advertise-addr ip with docker_gwbridge ip.

I faced the same problem.From firewall logs it looked like the firewall was blocking the swarm port.
After disabling the firewall it worked fine.

The --listen-addr and --advertise-addr are roughly the same except for one major difference; The former allows you to bind on all of your interfaces (it is the default) while the later is meant for specific, externally reachable interface. You only need to use --listen-addr when you have multiple interfaces and you do not want swarm mode traffic on all of them.

Having said that, in your case you provided both (which is redundant since the IPs are the same), however, you also listed 2 different ports for one single service. You can’t have the node management service on two different ports, so docker chose one of the port to listen. It would be nice if docker provided the correct join message and a warning … anyways, that is the reason you can’t connect on 2800. I would use just the --advertise-addr and default port 2377 (unless default port is taken) and add --listen-addr only if you have multiple interfaces and a business case to segregate traffic/services.

Hey guys, I just init the swarm in my current mac, which have the same issue with you.

$ docker swarm init --advertise-addr 192.168.99.100

If I create a manager1 firstly, then ssh into it and init the swarm, it works.

$ docker-machine create manager1
$ docker-machine ip manager1
# 192.168.99.104
$ docker-machine ssh manager1
docker@manager1:~$ docker swarm init --advertise-addr 192.168.99.104

Now, I create a worker1, then ssh into it and join it to the swarm cluster, it works perfectly.

$ docker-machine create -d virtualbox worker1
$ docker-machine ssh worker1
docker@worker1:~$ docker swarm join --token SWMTKN-1-1s06e6ubid2axcj3h9bo06smlj32jhqp74pj1wkmflb3f0x5pi-cde5dm1xdzo3eum3s7lrj96aa 192.168.99.104:2377

So, the problem is that we might not init the swarm in our current macos, but in a manager we create.

Run this command on each machine you’re using in the cluster (copy and paste everything below at one time[This is for dev use only]:

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 && firewall-cmd --reload && Systemctl restart docker

1 Like

Thanks this worked for me

After hours of pulling my hair out, I have finally gotten to the bottom of this issue and your solution lucked upon the answer without actually realising where the problem lay.

The issue is that the output of the previous command provided by docker-machine has an error.

Here’s what I typed and the response.

bash-3.2$ docker-machine ssh myvm1 “docker swarm init --advertise-addr 192.168.99.100”
Swarm initialized: current node (h7c9rk1a2ya4k2e5rjgnkpani) is now a manager.

To add a worker to this swarm, run the following command:

docker swarm join --token SWMTKN-1-6aqioo5188tneazemz37vqifq89tlkaaalm82xo3zsb5grf04n-cqc6ht42rrvt3qd6gk8eschuu 192.168.99.100:2377

Notice above that the command it gives you to enter to join the swarm includes the port number (2377) after the I.P. Address. This is the error. Instead enter up to the end of the IP address without the port number and it works as per below. Also, be sure to leave off the port number when creating the manager as well. It defaults to the correct port number of 2377.

bash-3.2$ docker-machine ssh myvm2 “docker swarm join --token SWMTKN-1-6aqioo5188tneazemz37vqifq89tlkaaalm82xo3zsb5grf04n-cqc6ht42rrvt3qd6gk8eschuu 192.168.99.100”

This node joined a swarm as a worker.

bash-3.2$

So you got there by splitting the command into it’s two parts, the SSH into the VM and then the Docker command, but you in fact also did not add the port and so it worked.

how can you access to docker_gwbridge ip from outside?

If I run the command without port number the result is :

docker-machine ssh myvm2 "docker swarm join --token SWMTKN-1-2btbvdbke3k506n9qt0myh3bbz1pf21sjh331z4zgiay8ooyfb-4fzzo02scu6nvhgljwb7ea47d [fe80::215:5dff:fe03:2a09]"

Error response from daemon: could not find local IP address: dial udp: address [fe80::215:5dff:fe03:2a09]: missing port in address
exit status 1

Docker on Window using hyper-v for create virtual machine .

And if use with port 2377, the response is :

Error response from daemon: could not find local IP address: dial udp [fe80::215:5dff:fe03:2a09]:2377: connect: invalid argument

I try the example from (Deploy to Swarm | Docker Docs), the leader was create, but the worker can’t join to swarm. For default it’s use ipv6 format. Any idea ?