Docker DNS Errors

· 158 words · 1 minute read

After previous issues with DNS resolution within Docker containers, they started to occur again while attempting to setup a Gitea Action to build a Ubiquiti Unifi container.

It seemed to occur when the container had the direct IP address of my DNS Server in /etc/resolv.conf rather than using the docker proxied DNS. When doing basic investigation (nslookup within an impacted container, the error I received was:

;; reply from unexpected source:, expected

My DNS server is on is the Gateway on the Docker network in use by the container.

This error pointed me to this forum post and a simple fix in the Adguard Home docker compose file. Instead of:

    - 53:53/udp
    - 53:53/tcp

it needed to be changed to:


to force docker to bind that port to the “external” IP of the machine rather than the docker network IP. After this the DNS resolution errors stopped.