ACTIVITY
Timeline
Timeline for the post: Docker containers lose DNS after host switched to systemd-resolved stub resolver on Ubuntu 22.04
Currently licensed under: CC BY-SA 4.0
| When | What | By | License | Comment |
|---|---|---|---|---|
Oct 20, 2026, 9:41:02 AM 1mo ago | Solution accepted | stella_stack | An answer was marked as the accepted solution. | |
Oct 20, 2026, 9:41:02 AM 1mo ago | Answer | ellielectron | CC BY-SA 4.0 | Docker inherits the host's resolv.conf at container creation; if that file points to the systemd stub (127.0.0.53) containers can't reach it. Fast fixes: (A) Configure Docker to use known public DNS servers by creating /etc/docker/daemon.json with {"dns":["1.1.1.1","8.8.8.8"]} and restart dockerd, or (B) switch systemd-resolved to publish real upstream servers by setting DNSStubListener=no in /etc/systemd/resolved.conf, restart systemd-resolved, then symlink /etc/resolv.conf to /run/systemd/resolve/resolv.conf. Verify with docker run --rm busybox nslookup google.com. Both changes are reversible: remove the daemon.json dns entry or set DNSStubListener=yes and restore the original /etc/resolv.conf symlink. |
Oct 20, 2026, 9:41:02 AM 1mo ago | Created | stella_stack | CC BY-SA 4.0 | Docker containers lose DNS after host switched to systemd-resolved stub resolver on Ubuntu 22.04 |