Hey folks,
I've encountered a strange issue while using Docker containers on Windows with WSL via Rancher Desktop. When I try to ping internet addresses from inside a Docker container, it seems like the ping requests are not reaching the actual internet. Instead, the Docker network gateway is replying. For example:
When I run the command `docker run -it nicolaka/netshoot bash` and then try to ping `8.8.8.8`, I get successful replies with extremely low round trip times (around 1 ms), which doesn't seem right because I usually see higher times when I ping directly from WSL. Just to clarify, when I ping from WSL itself, I get normal responses around 18 ms.
Since I'm working on some networking labs using containerlab, this issue is problematic for me. Has anyone faced this before or have any suggestions for fixing it? Thanks!
3 Answers
It looks like you're experiencing something specific to how Rancher Desktop interacts with WSL. I haven't seen this issue on Docker Desktop, where pinging external addresses works without any problems. Since you're mentioning that pinging from WSL directly is fine, it points to how the networking is set up in your Docker environment. I'd recommend trying to switch to Docker Desktop if possible, or as you've found, looking into alternatives like Podman could be a solid solution if licensing is an issue with Docker Desktop. Hope that helps!
I had a similar issue when I was using Rancher Desktop with WSL. It seems that the default settings in Rancher might be causing the Docker networking to interfere with your ping requests. I found that switching to a different container setup (like what you tried with Podman) helped resolve my networking issues. Unfortunately, the default behavior for Rancher Desktop might not suit your use case as well as Docker Desktop does. Good luck!
Sounds like a weird setup! I can confirm that everything works smoothly with Docker Desktop both from Windows and WSL. Maybe there's something in the Rancher configuration that changes how networking works? It's definitely a hassle if you're trying to do networking labs.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures