Docker Community Forums

Share and learn in the Docker community.

Cannot ping ubuntu from Windows Docker


(Garyshenry) #1

For one of our client/server applications I have the client on the Windows host and the server on the Ubuntu container. Normally we specify the server’s host or ip address to access the server. When I start the Ubuntu container like this:

docker run -it --rm --hostname gary acu1030x64 /bin/bash

my /etc/hosts shows:

127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.17.0.2 gary

On my Windows 10 host if I try to ping gary or 172.17.0.2 it does not work:

ping 172.17.0.2

Pinging 172.17.0.2 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 172.17.0.2:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

My Windows computer is on my local intranet:

Ethernet adapter Ethernet:

Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::fd1a:508f:81d1:6e9f%4
IPv4 Address. . . . . . . . . . . : 192.168.0.9
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.1

I don’t know a lot about networking but thought you might know how I can run or setup my Ubuntu container so that I can ping it from my Windows host. Any ideas? If it would be better to use a Linux host let me know.

Is the ubuntu container designed so it is not possible to ping it from Windows Docker?

Thanks!

Gary


(Microlise1982) #2

To allow your container to communicate out through the host VM/PC, connect it to your host network which replicates the network configuration of the host within the container.

docker run -it --rm  --network host --hostname gary acu1030x64 /bin/bash

(Garyshenry) #3

Thanks for the suggestion but after using the command you suggested I am still not able to ping my Ubuntu container using Windows docker. Were you able to ping your ubuntu container? If so, can you show me your IP address of your Ubuntu container and the IP of your Windows computer? Thanks!