0
votes

I am on windows 10 pro

With windows containers, I am able to ping but with linux containers I am not. Just curious, any reason?

docker version command shows me OS/Arch: linux/amd64

Now I run the following to create a container.

docker run --rm -it mcr.microsoft.com/dotnet/core/aspnet:3.1

Now I run docker ps to get the id of the container and then inspect on it to get the ip address.

docker ps -a

docker inspect fad3v34.

Now when I ping the ip address

ping 172.17.0.2

I get request timed out.

But Now I switch to windows container.

Now to confirm I run

docker version

command and I get

OS/Arch: windows/amd64

Now again I create the container with the same command

docker run --rm -it mcr.microsoft.com/dotnet/core/aspnet:3.1

Get the ip address as before and then when I do

ping 172.29.252.35

Pinging 172.29.252.35 with 32 bytes of data: Reply from 172.29.252.35: bytes=32 time<1ms TTL=128 Reply from 172.29.252.35: bytes=32 time<1ms TTL=128 Reply from 172.29.252.35: bytes=32 time<1ms TTL=128 Reply from 172.29.252.35: bytes=32 time<1ms TTL=128

Ping statistics for 172.29.252.35: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms

Why?

1

1 Answers

1
votes

It’s possible that the the Linux containers you are using disallow ping. First be sure that you are exposing your application’s port. Then try using telnet to test from the the host to container. If you failed to map the ip and port correctly this test will fail.