Docker Community Forums

Share and learn in the Docker community.

Access to private networks inside the container

Hi all,

First, let me describe the scenario.
Host A, with a publicIP address and also connected to a private network.
Host B, with another publicIP addres and connected to another private network.

First of all I create a swarm, HostA is the master.
Then, I create a nginx web service and start up in hostA.
I can access by typing HostB publicIP and port 8080, everything fine!!

My question is… if a run “docker exec -ti nginx /bin/sh”, inside the container I don’t have access to my private networks, for example doing “ping 192.168.10.2” (hostB private ip address). It seems private network routing table is not populated inside the container. Is it possible to have this kind of scenario working?

Thanks in advanced,
Alberto.