Docker Community Forums

Share and learn in the Docker community.

How to ping from windows to docker container running on Ubuntu Guest on VBox


(Royatdocker) #1

I have windows 10 operating system on a desktop. On the windows system I run VBox with a Ubuntu 16.04 as a guest (guest of windows and VBox). In that Ubuntu guest I run a docker container.

Here are the networking details:
On windows machine:
IP: 192.168.1.113 (subnet mask: 255.255.255.0)
Default gateway: 192.168.1.99
VBox network adapter 1: NAT
VBox network adapter 2: Bridged Adapter

Interfaces on Ubuntu 16.04 (guest on VBOX), using ifconfig:
IDocker0: IP: 172.17.0.1 (mask 255.255.0.0)
Ienp0s8 (ethernet): IP: 192.168.1.119 (mask: 255.255.255.0)
enp0s3 : IP: 10.0.2.15 (mask: 255.255.255.0)
lo: 127.0.0.1 (mask: 255.0.0.0)

Interfaces on docker container, using ifconfig :
eth0: IP: 172.17.0.2 (mask: 255.255.0.0)
lo: 127.0.0.1 (mask: 255.0.0.0)

So, we have windows -> vbox -> ubuntu -> docker container.

When ping the container from Ubuntu (ping 172.17.0.2 ) it works, so the Ubuntu guest knows how to reach the 172.17.X.X subnet of the container.

However when I ping the container, the same command, from windows, it fails.
It also fails even if I add a route command on windows, to route the container’s 172.17.X.X subnet to the ubuntu guest with IP 192.168.1.119 (and Ubuntu knows how to reach 172.17.X.X, since pinging from there works.)
(On windows I used the command: route ADD 172.17.0.0 MASK 255.255.0.0 192.168.1.119)

Any ideas how to ping/connect from windows to the container?


(Sam) #2

you cannot connect directly. the docker network does not exist outside the docker host…

you can only map the ports from the container onto the docker host and then access the container application thru the host address…


(Royatdocker) #3

Does this mean that I cannot run multiple containers with different IP’s on the same host, and connect to them using their IP’s and not port numbers?

Is there no way to connect the docker network to the host network and to the underlying network of the windows? After all, in the system I described, the docker network is recognized from the linux guest system (guest of VBox), so surely we make some sort of routing based on IPs ?


(Sam) #4

the container is NOT a virtual machine, the docker ‘network’ is NOT designed to be exposed outside the docker host. virtual machine (vox) network drivers do completely different things than the docker support provides.

ps I have struggled with this for years, without a solution that works. one of the products i need to support would be outstanding if I could use docker to deploy its components across multiple real systems in a worldwide network. but the app networking demands a fully addressable and reachable network… just not possible.

i run both windows and ubuntu physical systems running docker and vmware, with vmware hosting ubuntu, windows and mac virtual machine guests, all with docker running inside each guest.

from any system on the physical network, I can connect to the vm guests, but not directly to the containers on those guests.