Docker Community Forums

Share and learn in the Docker community.

Docker swarm overlay networking, connecting to the swarm from outside or localhost

(Yamackurtulus) #1

I cannot connect to the published port on the swarm that uses overlay networking. I am using Docker for Windows with Windows containers. Both Windows and Docker are fully upgraded. After Windows’ 1709 update, I was hoping this issue would be resolved. I looked for information on the Internet to see if I was doing something wrong to no avail. I would like to know if anyone was successfully able to get it working.

On a side note, when I direct the port on my machine in docker run -p 80:80 without using swarm, “localhost” does not work as well. I think this is a known limitation though. Both issues work when I switch to Linux containers.

Expected behavior

I am running a dotnet kestrel web server service. I should be able to connect to my service using the published port.

Actual behavior

Firefox gives me timeout, opera straight away returns connection refused. Cannot telnet into it either. Container IP’s assigned by the overlay network do not work either.


docker service ls gives me this:

Ports cannot be seen there, is it because publish mode is host? Ports information is available in the output of docker service ps

And when I change the publish mode, I can scale it as well and the port information is seen in docker service ls albeit still cannot connect. the one below is without the publish mode=host parameter:

For more info, this is the output of the docker network ls I wonder if i need some sort of bridge network like in Linux.

Steps to reproduce the behavior

  1. Initialise swarm
  2. Start the service, in my case: a simple web service built using aspnetcore:latest image. I tried different parameters, even used a docker-stack.yml:
    docker service create --name=web --publish mode=host,published=80,target=80 web:aspnetcorelatest in the case above, I was unable to scale it on the same machine, which is normal i guess
    docker service create --name=web --publish published=85,target=80 web:aspnetcorelatest
  3. Try to connect using one of http://localhost or another IP. I tried connecting over VPN, from another machine as well as Internet IP.