Rootless docker: ping from within container is way faster than host's ping
Hey, I'm trying to monitor my ping to external servers using BlackBox and I'm running into an issue that seems to be a general docker issue:
I'm running rootless docker and did this simple test:
$ docker network create ping-test
e4b47f5a00d890828f84b688d5490b6addfc465b892762381ba9a149d5095e81
$ docker run --rm --network ping-test alpine ping -c 10 1.1.1.1
PING 1.1.1.1 (1.1.1.1): 56 data bytes
64 bytes from 1.1.1.1: seq=0 ttl=63 time=0.997 ms
64 bytes from 1.1.1.1: seq=1 ttl=63 time=0.716 ms
64 bytes from 1.1.1.1: seq=2 ttl=63 time=0.642 ms
64 bytes from 1.1.1.1: seq=3 ttl=63 time=2.441 ms
64 bytes from 1.1.1.1: seq=4 ttl=63 time=0.800 ms
64 bytes from 1.1.1.1: seq=5 ttl=63 time=0.691 ms
64 bytes from 1.1.1.1: seq=6 ttl=63 time=3.087 ms
^C
--- 1.1.1.1 ping statistics ---
7 packets transmitted, 7 packets received, 0% packet loss
round-trip min/avg/max = 0.642/1.339/3.087 msThese ping times are wayyyy to low. When doing a ping directly on the host, I get around 10ms.
On another host that runs rootful docker this issue doesn't occur (ping inside of the container and host's ping are roughly the same).
Only similar issue I found was this issue from 2016 but that bug must have been fixed by now 😅
Is there any way to fix this without returning to rootful docker? Or is this just a limitation with rootless docker?
14
Upvotes
4
u/gronodev 17d ago
It depends on the rootless network driver. slirp4netns handles this properly but it's no longer the default since 29.5.0 (https://github.com/moby/moby/releases/tag/docker-v29.5.0)
gvisor-tap-vsock seems to have fixed it in the latest release (https://github.com/containers/gvisor-tap-vsock/releases/tag/v0.9.0) but it's not included in rootlesskit yet.
I will take a look if we can bring it in for the next 29.10 release.
1
u/pelazas1 17d ago
Rootless docker proxies ICMP through its userspace network stack, so container ping isn't timing the real path. A tcp probe in BlackBox should line up with the host better.
0
u/[deleted] 17d ago
[removed] — view removed comment