Docker Community Forums

Share and learn in the Docker community.

Unable to ping container from host

docker

(Drahamimdocker) #1

I am starting a container (windows container), and trying to ping it from host - unsuccessfully.
I noticed that I don’t have the DockerNAT, so I have uninstalled, reboot, install Docker, and now it appears.
However, yet, I am unable to ping the container for the host.

What can be the problem?
It used to work in the past…

BTW, running on windows 10.

UPDATE: When attaching the container to my own NAT network - it is working.
Looks like a problem with the default nat network created by Docker…


(David Maze) #2

This is not a useful exercise, for two reasons. First, the usual way to access containers is to use the docker run -p option to publish a port on the host; you should never use the container’s private IP address, it’s a Docker implementation detail and trying to use it will cause no end of complications and troubles. Second, ping is a network debugging tool for a protocol (ICMP) that you never use for communicating with containers; using a tool that will actually try to talk to your container (e.g., curl or wget for an HTTP-based container) is better.


(Drahamimdocker) #3

Unfortunately, you haven’t answered the question.
The ping was only meant to test connection, otherwise the port binding is iirelevant.

I can update that my HNS internal NIC was disabled, and after enabling it, I managed to get a ping result.


(Evmurphy) #4

I’m also running into this issue. I’ve reinstalled Docker for Windows (both stable and edge versions) and still cannot ping my container from the host. My container is running on the Docker nat network.

>docker network ls
f0f191723f67        Default Switch      ics                 local
e35873150733        nat                 nat                 local
f4fdc8b71c99        none                null                local
>Get-VMSwitch
Name           SwitchType NetAdapterInterfaceDescription
----           ---------- ------------------------------
nat            External   Intel(R) Ethernet Connection (2) I218-LM
Default Switch Internal
DockerNAT      Internal

How exactly did you solve this?


(Drahamimdocker) #5

Well, I went to the ‘change adapter settings’ on windows, and noticed that
the vNIC representing the defualt nat network was disabled. Right click to
enable it, solved the problem.

You need to make sure you see DockerNAT and the vNIC there.