2

There are 4 node in my swarm, two of them are in Hongkong, the others are in USA. I create 4 service in the swarm:

Service    Location
foo        USA
bar        HK
haha       USA
hehe       HK

These services use a same overlay network. When I try ping foo or ping haha in HK's services, the host can't be resolved. But when I ping bar or ping hehe in HK's services, it works.

Any help will be appreciated, thank you!

I'm sure that all the required ports are open and accessable.

I use these commands to create services:

docker network create -d overlay --attachable test_net
docker service create --name foo --network test_net nginx:alpine
Tao Zhu
  • 749
  • 6
  • 12
  • It will help to provide more detail. What happens when pinging between two containers on the same overlay that's on the same host? Are the two containers you're trying to ping on the same overlay network? Give us commands and configs so we know what you tried to do. If it can't resolve a DNS name to IP, that's a DNS issue, not a "I can't reach host" issue. – Bret Fisher Feb 26 '18 at 04:11
  • related: https://stackoverflow.com/questions/64737001/multi-cloud-swarm-cluster-service-discovery-using-dns – lepe Mar 01 '23 at 01:38

1 Answers1

1

You need to make sure the following ports are open between your docker hosts:

  • TCP port 2377 for cluster management communications

  • TCP and UDP port 7946 for communication among nodes

  • UDP port 4789 for overlay network traffic

See the following for more details: https://docs.docker.com/network/overlay/#operations-for-all-overlay-networks

BMitch
  • 231,797
  • 42
  • 475
  • 450