'Error response from daemon: Timeout was reached before node joined

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



Solution 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Rafhael