FULL AI ANALYSIS

Ubuntu 22.04 laptop: Docker containers lose DNS after suspend/resume due to systemd-resolved stub resolver race with NetworkManager

Generated Oct 18, 2026, 9:45:27 AM

Analysis summary

Containers relying on host stub resolver (127.0.0.53) will hit an ephemeral socket race: on resume NetworkManager reconfigures DNS and systemd-resolved may briefly unbind/rebind its stub listener; meanwhile containers' libc resolvers keep referring to the stub address but the Docker bridge isolates container networking from host namespace, causing packets to 127.0.0.53 to be routed incorrectly until Docker restarts or host rebinds socket. Workarounds: have Docker inject real upstream DNS into containers via daemon.json dns entries or use dnsmasq bound to non-loopback address; alternatively configure systemd-resolved to provide a stable local IP (127.0.0.53 is valid only in host network namespace) by exposing a nameserver on an interface address reachable from containers.

Possible causes

Race where systemd-resolved's stub listener is briefly unavailable after resume and containers' DNS queries to 127.0.0.53 are refused until Docker restart

90%

Docker bridge network isolates container network namespace so host-local stub address isn't consistently reachable through normal container networking after DNS rebind events

65%

NetworkManager reconfiguration replaces resolv.conf symlink in a way containers don't observe, leaving stale references

40%

Docker daemon bug handling host DNS updates on dynamic network changes requiring manual restart

30%

Suggested fixes

1

Diagnostic step 1

Short-term: configure Docker daemon with fixed upstream DNS entries (e.g., in /etc/docker/daemon.json set "dns": ["1.1.1.1","8.8.8.8"]) and restart Docker; reversible by removing entries.

2

Diagnostic step 2

Better: run a lightweight DNS forwarder (dnsmasq) on the host bound to the host's bridge IP (not 127.0.0.1), and set Docker daemon 'dns' to that IP so containers use a stable nameserver across resume.

3

Diagnostic step 3

Alternative: start containers with --network=host where appropriate so they use host stub resolver directly (caveat: network isolation loss).

4

Diagnostic step 4

Report reproducible minimal case to Docker/NetworkManager if behavior persists; collect tcpdump of container-to-127.0.0.53 attempts around resume.