Target: Creating a Docker Swarm
Condition:
Operation:
docker swarm init
docker swarm join --token SWMTKN-1-3o2m78qf57hy2zikfx8p2yc7hrn63edlmlixwrq7bh28xws7zx-9oirn0wh3mbrdui3kcwytl560 192.168.65.9:2377
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:
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.
You need to open several ports for the communication (On A
as well ass B
hosts):
As Docker documentations says:
Furthermore:
Set UFW config (Or disable the UFW as you mentioned in your question):
ufw allow 22/tcp
ufw allow 2376/tcp
ufw allow 2377/tcp
ufw allow 7946/tcp
ufw allow 7946/udp
ufw allow 4789/udp
ufw reload
ufw enable
systemctl restart docker
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)