Container nslookup succeeds but ping fails?

I’m able to docker run busybox nslookup google.com but when I run docker run busybox ping -c 4 184.24.26.220 I get:

4 packets transmitted, 0 packets received, 100% packet loss

I’m also unable to docker run ubuntu apt-get update, which is what I was trying to do in the first place. I get a long error that says:

...
Could not connect to security.ubuntu.com:80 (91.189.91.39). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (91.189.91.38). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (185.125.190.36). - connect (101: Network is unreachable) Could not connect to security.ubuntu.com:80 (185.125.190.39). - connect (101: Network is unreachable)
...

I’ve tried setting --network=host and --network-bridge. I’ve also made sure that my firewall (TinyWall) isn’t blocking the connection. I am running BitDefender on Windows 10 but it’s not blocking anything.

I’m a bit new and out of my depth. Anybody know what’s going on? I’ve been at this for two days now.

If it wasn’t a temporary issue with the server of the repository and you still experience the same error, than it could be a network issue anywhere between you and the repository. Unless you could access the same ip address from your host without containers.

I’m wodnering, are you using Docker Desktop or Docker CE?

Thanks for replying. I’ve been at this for two days now so it’s definitely not a temporary network issue afaik. This same command runs fine on a Fly.io instance for an app that I have. Also, I can definitely ping it from any of my host terminals just fine. I can also ping it from a virtual Linux distro in VirtualBox:

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

I’m using Docker Desktop on Windows 10 atm. The issue seems to be my local Docker installation but I have no idea how to debug or what to look for.

Managed to trace it down to TinyWall. It seems that the firewall doesn’t know how to set the rules for WSL applications when it’s in Autolearn mode. I disabled the firewall, tried the docker run busybox ping -c 4 184.24.26.220 command that worked, and then re-enabled the firewall again. It seems that it remembered the setting this time and now I’m able to connect just fine. :upside_down_face:

Thanks for the prompt support, @rimelek, you were absolutely right.

TL;DR: Try disabling and re-enabling TinyWall.

Thank you for sharing the solution! :slight_smile:

1 Like