-
Target: Creating a Docker Swarm
-
Condition:
- Host A: Ubuntu 23.10
- Host B: Mac Sonoma 14.1.2
-
Operation:
- In Host A:
docker swarm init
- In Host B:
docker swarm join --token SWMTKN-1-3o2m78qf57hy2zikfx8p2yc7hrn63edlmlixwrq7bh28xws7zx-9oirn0wh3mbrdui3kcwytl560 192.168.65.9:2377
- In Host A:
-
Error:
Error response from daemon: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing dial tcp 192.168.65.9:2377: connect: no route to host"
-
What I’ve done so far:
- Installed firewalld on Ubuntu Host A, but for unknown reason it caused system crash. I guess this is because Ubuntu 23.10 doesn’t support firewalld anymore.
- Use ufw command to open communication port on Ubuntu Host A, but it doesn’t work.
-
Asking for help: I saw other people can easily run the "docker swarm join" command in the tutorial. Why I got this problem? Any one can help me out? Really appreciate your help.
2
Answers
You need to open several ports for the communication (On
A
as well assB
hosts):As Docker documentations says:
Furthermore:
Set UFW config (Or disable the UFW as you mentioned in your question):
You can check the IpTables configuration as well based on this documentation: https://www.digitalocean.com/community/tutorials/how-to-configure-the-linux-firewall-for-docker-swarm-on-ubuntu-16-04
BUT, The "Docker for Mac" uses different networking as Linux based and that can cause turbulence in Docker Swarm. Here is a ticket for it: https://github.com/moby/swarmkit/issues/1146#issuecomment-231412874
Based on the above ticket the Mac can run only single-node Swarm right now. (I didn’t find fix for it)
You need to connect machines together verify that by ping (if you are using a firewall then ping ICMP packets wont work). do a curl request from A to B
ufw status
if its status: inactive then its not a problem else disable the firewall(DISCLAIMER: may become a security issue) or Open only specific ports like 2376, 4789, 2377, 7946.sudo ufw reload