Problem with services on the same network, Docker Swarm

I have a machine in AWS and another in ORACLE, both part of a Swarm, and both are managers.

I created an overlay network my_net , then I created 2 services:

docker service create --name ngx0 --network my_net -p 8080:80 nginx (ORACLE)
docker service create --name ngx1 --network my_net -p 8888:80 nginx (AWS)

I entered the aws service (ngx1) and tried curl ngx1 and it worked normally, but I tried curl ngx0 which would be the one from oracle, and it didn’t work, the same happens in oracle, there curl ngx0 works and curl ngx1 does not

docker network inspect my_net, in aws machine


docker network inspect my_net, in oracle machine

I am afraid you will have to provide way more details about how your setup looks like, what you did and why expect it to work.

Does docker node ls show both nodes connected? How did you create the overlay network?

and I just create with docker network create -d overlay my_net

alright, what do you need?

Everything required to get an understanding of why this should work. Basically what’s the exact difference between you setup, compared to a setup where the nodes are in the same subnet of a low latency network.

I ran these commands above. With the two services, ngx0 in aws and the ngx1 service in oracle for example, both on the same network overlay, if I enter one of the containers, and curl on the name of the service I connected to, it works normally, but when I try to curl the name of the opposite service, it doesn’t work

If the nodes were in the same private subnet, those commands indeed would be enough, but that’s not your use case, is it?

Please don’t make us guess how your setup looks like, or make us ask about things you should know.

Shouldn’t I be able to communicate with the other service, from another node, just by using its service name?

Aditional info:


What I expected you to share as part of your first post are details like:

  • Do the compute nodes use public or private ip’s?
    • In case of private how did you connect the networks?
  • How are the security groups configured?

Even if they run with public ips (which is a security no-no!), you must have at least configured security groups.

That’s what I did:

just create 2 machines, 1 in aws and 1 in oracle, after that I follow docker’s guide to open the recommended ports: (all for this 0.0.0.0/0)

Finally, I connect both to the swarm, then I run the test of this related post

Try to create a global service:

docker service create \
  --name whoami \
  --mode global \
  --network my_net \
  traefik/whoami

Then check if it’s running on all nodes:

docker service ps whoami