8

I can ping an IP from host box (Linux centos rhel 7.2) but when I do the same inside docker container, it fails to respond.

[root@f321ef079128]# ping 10.254.19.46 PING 10.254.19.46 (10.254.19.46) 56(84) bytes of data.

What can be the issue?

Thanks

Umapathy
  • 106
  • 1
  • 3
  • 9
  • Let me ask you this. Are you able to ping your Docker container from the host? – Runcy Oommen Oct 31 '16 at 10:32
  • Yes I could. Inside container, I couldn't ping google.com as well. looks like internet connectivity is disabled. how to enable that? – Umapathy Oct 31 '16 at 10:37
  • I highly doubt it's an internet issue as your connectivity to host itself does not go through. Are you able to ping 127.0.0.1 from inside the container? – Runcy Oommen Oct 31 '16 at 10:39
  • [root@f321ef079128]# ping 127.0.0.1 PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data. 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.043 ms 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.054 ms 64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.089 ms 64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.119 ms 64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.066 ms – Umapathy Oct 31 '16 at 10:39
  • OK, so no issue with n/w card. What container image is this? Is iptables enabled? – Runcy Oommen Oct 31 '16 at 10:42
  • @RuncyOommen docker restart fixed it. – Umapathy Oct 31 '16 at 10:51

2 Answers2

5

This might help:

My docker container has no internet

Top suggestions seems to be to restart the docker service:

service docker restart
Community
  • 1
  • 1
mattjtyas
  • 51
  • 2
2

i think you dont have internet acces in container. Try run your container with:

docker run --dns **your_dns** ...
killmarils
  • 21
  • 3