Docker DNS timeout errors

· 221 words · 2 minute read

This site is a static site powered by Hugo, built automatically using a Gitea runner (Gitea’s equivalent of GitHub actions). Last time the runner tried to fetch the git repository, it failed with a DNS lookup error.

In the process of changing routers and get ESPHome mDNS lookups working (see ESPHome Dashboard mDNS not resolving), I thought i’d managed to break DNS for my docker containers. Weirdly, some containers on the same docker network could resolve DNS records without issue. The error when running journalctl -u docker -n 100 was:

msg="[resolver] failed to query external DNS server" error="read udp 172.18.0.4:48272->10.0.0.1:53: i/o timeout"

This docker IP (172.18.0.4) was the new container. Existing containers were fine. As I use AdGuard Home for internal DNS, I next checked the logs for the AdGuard Home container

[error] dnsproxy: unpacking udp packet: dns: buffer size too small

Searching for this found that two system parameters needed to be changed

sudo sysctl -w net.core.rmem_max=7500000
sudo sysctl -w net.core.wmem_max=7500000

echo net.core.rmem_max = 7500000 | sudo tee -a /etc/sysctl.conf
echo net.core.wmem_max = 7500000 | sudo tee -a /etc/sysctl.conf

As with the change required for mDNS resolution, I’m not sure what has changed to require this. The timing aligns with the upgrade from Ubuntu 22.04 to 24.04, I need to work out whether the kernel defaults changed in 24.04 LTS.