How to connect a ec2 instance with a local cluster?


I've been trying to connect an ec2 machine from aws to my localhost (WSL on windows) docker swarmer cluster, but i keep getting displayerd : 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." and the ec2 is not being added as a node (even if later I try to add it again, it says that it is already part of a cluster, on my localhost it does not appear added).

What I've been tried: Open the doors 2377, 7946 and 4789 (required by docker) on my wsl and ec2. approved all traffic to all ports on my ec2 firewall. desable my windows firewall (Tried to init a windows cluster to add ec2, but did not worked too.

Aditional information: to open the doors on my wsl/ec2 I mainly used ufw and telnet. I was able to connect my windows docker to my wsl cluster. I'm being able to ping my ec2 ipv4 adress from mylocalhost, but not my localhost ip from ec2.

Any suggestions and solutions are welcome, i'm seriously HOURS in this, any progress will make me happy

Systems: I'm using ubuntu 18-04 on wsl and ecs, and windows 11 a print of my ec2 security firewall

1 Answer

There could be several factors that might be causing the error "Timeout was reached before node joined." when trying to connect EC2 instance to localhost Docker Swarm cluster. Here are some of the steps that you can try:

Verify the Docker version and compatibility - Ensure that the Docker version installed on EC2 instance and localhost are compatible.

Verify the Docker swarm join command - Ensure that the correct command is being used to join the EC2 instance to the Docker Swarm cluster.

Check the network connectivity - Ensure that the EC2 instance and localhost can communicate over the network and the required ports are open.

Disable Docker's swarm mode - If you have initialized a swarm mode on your EC2 instance earlier, try disabling it and join the EC2 instance to the localhost Docker Swarm cluster.

Check for firewall restrictions - Ensure that there are no firewall restrictions that are blocking the communication between the EC2 instance and localhost.

Check for security groups - Ensure that the security groups for EC2 instance and localhost allow communication over the required ports.

Check the IP configuration - Ensure that the IP address of EC2 instance and localhost are correctly configured.

It is recommended to follow these steps and verify each point to resolve the issue. If these steps do not resolve the issue, please provide additional details or logs related to the error.

profile picture
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions