Docker Community Forums

Share and learn in the Docker community.

Host in the public network can't access container in overlay network

(Hanzhaolumos) #1

1 I use consul and docker overlay network driver created a multihost network
2 Start container eg:ct1 and publish its port to host port
3 Then i always failed to access the “ct1” from another host
4 the firewall is already closed
5 without docker machine and swarm , just with docker engine and consul
operation environment:
centos version 7 , the latest docker engine

(Schlichting) #2


overlay networks are closed for external access by default. You can however access exposed ports on the hosts of the container over the docker bridge. Look for the ip address of eth1.
If you add the [–internal] option when creating the network (e.g. docker create network --internal --subnet foo), this connection is disabled too.

To access containers in overlay networks (internal or not) from other hosts, connect a container to the overlay network (e.g. docker network connect NETWORKNAME CONTAINERNAME).

(Hanzhaolumos) #3

Thanks for your reply. but it does not sovle my problem.
May be i did not explain my question clearly.
When i create overlay network, I did not add the [–internal] option. And i also exposed ports to for external access.

(Hanzhaolumos) #4

Finally, I sovle this problem. The container in overlay network have two network interface eth0、eth1. My app listening on eth0, but the external host must through eth1 to access my app.
So i bind ip address to INADDR_ANY

(Gurukraj) #5

I am facing this problem in my environment as well. I have two docker hosts with multiple containers running and communicating over overlay networks. I can ping from container to docker host as well as container to container. However I cannot ping from docker hosts to containers. Please provide detail steps that you did.,

(Srikanthhub) #6

Did you get solution for this.? In my scenario, i have installed oracle db in one container and domain in another container. those containers are running in different docker machines and those are connected via overlay network. i can able to ping between container to container and container to host, but not host to container. Now my admin server is running in 2nd container. i am unable to access the URL from eth0 and eth1. Am I missing any configuration here? please help me regarding this. Thanks in advance…

(Rajeshanayaka) #7

I am having exactly same issue in my Windows Server 2016 container host in Swarm Mode.