Docker Swarm Connectivity Issue: "No route to host" When Trying to Add Worker

I’m encountering an issue when trying to add a worker node to my Docker Swarm cluster. Despite basic network connectivity working (confirmed by ping), I’m receiving an error when attempting to execute the docker swarm join command on the worker node.

Environment Details:

  • Two instances on Oracle Cloud Infrastructure (OCI).
  • Both instances are Ubuntu and located in the same subnet.
  • The instances are: manager (10.0.0.187) and node (10.0.0.41).

Symptoms:

  • When trying to execute docker swarm join --token <token> 10.0.0.187:2377 on the node worker, I receive the following error:
Error response from daemon: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial tcp 10.0.0.187:2377: connect: no route to host"
  • Pinging from node to manager is successful.
  • Port 2377 is open on iptables on both hosts.
  • nmap on node shows that port 2377 on manager is in “filtered” state.

Actions Taken:

  1. Checked and confirmed that iptables rules are correctly configured to allow traffic on port 2377 on both hosts.
  2. OCI security rules are set to allow traffic on relevant Docker Swarm ports ( 2377, 7946, 4789 tcp and udp ).
  3. Port 2377 is listening on manager, as confirmed by netstat.
  4. Attempted telnet and nc from node to manager on port 2377, but both failed with “No route to host”.
  5. Restarted and even recreated the instances, but the issue persists.
  6. UFW inactivated

Request for Help: I’m seeking suggestions or insights into what might be causing this specific connectivity issue on Docker Swarm’s port 2377, and how I might resolve it. Any assistance or guidance will be greatly appreciated!

Try to confirm that it is a Docker issue and not just a general network issue. Run for example a simple server using python. Docker container could work as well, but let’s not add that network layer yet. I usually do this on one server:

mkdir servertest
cd servertest
python3 -m http.server 9999

Then run this on another:

curl REMOTE_IP:9999

If you get “no route to host”, then it is not related to Docker. Try it to both direction. Manager to worker, worker to manager.

ping is an ICMP package, and can be disabled separately.

Hello @rimelek

Thanks for the valuable suggestion to perform basic connectivity tests between the nodes of my Docker Swarm. Following Ákos’s recommendation to set up a simple Python HTTP server and test connectivity with curl, I discovered that the issue I was facing was indeed a network connectivity problem, not specifically a Docker issue.

During the test, I realized that communication from node to manager was working, but the reverse communication failed with a “No route to host” error. This led me to delve deeper into network configurations, specifically the iptables rules on my servers.

Fortunately, I was able to identify and correct the iptables rules that were causing the issue. After adjusting these rules, connectivity between the nodes was restored, and the Docker Swarm is now functioning as expected.