1

I have been trying to join a worker to a manager node but I'm not able to. My manager node is running on my personal laptop which runs ubuntu 18. The worker node im trying to make is on an ec2 instance which also runs ubuntu. To create the manager node I wrote this and created it successfully.

docker swarm init --advertise-addr 192.168.10.10:2377

which returns:


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

    docker swarm join --token SWMTKN-1-2ywtsoky86nabtq10try9jwnap7j3guigh1hywcfyb5u4tv0m5-a8zwarpuk1j79hy60yke2hrbk 192.168.10.10:2377

To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

After that i go to my ec2 instance ubuntu and run this command:

docker swarm join --token SWMTKN-1-2ywtsoky86nabtq10try9jwnap7j3guigh1hywcfyb5u4tv0m5-a8zwarpuk1j79hy60yke2hrbk 192.168.10.10:2377

which shows me this error: Error response from daemon: Timeout was reached before node joined. The attempt to join the swarm will continue in the background. Use the "docker info" command to see the current swarm status of your node.

I've tried allowing the port 2377 on firewall on both systems and restarting it but it still doesn't work. Does anyone know the reason its not connecting?

Update 1: I've also tried to match the time zones of both systems but that doesn't work either

Thanks

3 Answers3

2

you can run netstat -tulpn | grep LISTEN to see all ports you need to allow. In my case it was:

ufw allow 22/tcp &&
ufw allow 53/tcp &&
ufw allow 2377/tcp &&
ufw allow 7946/tcp &&
ufw allow 7946/udp &&
ufw allow 4789/udp &&
ufw reload &&
ufw enable &&
systemctl restart docker
Rafhael
  • 21
  • 3
  • 1
    Run the above commands on the manager node but make sure you in as the root user or the admin. Thank you @Rafhael. – Kasasira Nov 07 '22 at 15:55
1

If you are running on some public cloud, make sure that access lists in EC2 security groups and allow connections between hosts on that port.

0

I had the same problem with this. first, try to connect to the server with swarm enabled by telnet from the worker node server. In my problem, this was not working, which meant that the error I was getting when I ran the docker swarm join command was related to the firewall. As a solution, I allowed 2377/TCP port in the firewall on the server that will be the first worker node. But this was not the solution. For the second time, I allowed 2377/TCP port in the firewall on the server with the manager node. In this case, the worker node was able to join the swarm.

ufw allow 2377/tcp

Abbas
  • 51
  • 4