Docker-Swarm: Join a docker-swarm from another subnet

0 votes

I have 4 virtual machines in the same subnet, which are part of a docker-swarm. Now I want connect another node (virtual machine), which is located in a different subnet.

How do i set an overlay network in docker that is able to handle such a connection?

Aug 22, 2018 in Docker by lina
• 8,160 points
298 views

1 answer to this question.

0 votes

You need the following ports open between your swarm nodes:

  • 2377/tcp: Swarm mode api
  • 7946/both: Overlay networking control
  • 4789/udp: Overlay networking data
  • protocol 50 for ipsec (secure option) of overlay networking

The following iptables commands can be used for this (you may want to limit the source host to only your other docker swarm nodes):

iptables -A INPUT -p tcp -m tcp --dport 2377 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 7946 -j ACCEPT
iptables -A INPUT -p tcp -m udp --dport 7946 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 4789 -j ACCEPT
iptables -A INPUT -p 50 -j ACCEPT

This needs to be configured on all of your swarm nodes if they have a restrictive host firewall, and on the network firewalls protecting your subnets.

answered Aug 22, 2018 by Nilesh
• 6,920 points

Related Questions In Docker

0 votes
2 answers
0 votes
1 answer
+4 votes
4 answers

How To Access a Service on Host From a Docker Container?

Adding to kalgi's answer, You can also ...READ MORE

answered Oct 16, 2018 in Docker by lina
• 8,160 points

edited Oct 16, 2018 by lina 5,911 views
0 votes
1 answer
+5 votes
7 answers

Docker swarm vs kubernetes

Swarm is easy handling while kn8 is ...READ MORE

answered Aug 27, 2018 in Docker by Mahesh Ajmeria
1,074 views
0 votes
1 answer

Docker Swarm- Build image only when stack deployed from manager node

Use docker build to build the image. ...READ MORE

answered Aug 24, 2018 in Docker by Nilesh
• 6,920 points
65 views
0 votes
1 answer

Restore a docker swarm

If there is something wrong only with ...READ MORE

answered Aug 24, 2018 in Docker by Nilesh
• 6,920 points
32 views