FULL AI ANALYSIS

Ubuntu 22.04 laptop: Docker containers lose DNS resolution after suspend/resume (systemd-resolved stub resolver conflict)

Generated Oct 16, 2026, 9:43:08 AM

Analysis summary

Docker captures /etc/resolv.conf from the host when the container is created. On systems using systemd-resolved with a changing upstream (VPNs, Wi‑Fi), the host's /etc/resolv.conf often points to the local stub (127.0.0.53), but NetworkManager or systemd updates upstream servers after resume. Docker-internal DNS doesn't dynamically reconfigure existing containers; the engine or container must be recreated to pick up new DNS. This is expected behavior. The observed difference between containers and host (host resolves, containers don't) confirms stale resolv.conf inside containers. Workarounds include running Docker with a stable DNS server, using a local DNS forwarder bound to a stable address accessible from containers, or using Docker's --dns option when starting containers. System-level integration approaches exist but are not automatic.

Possible causes

Docker copies host resolv.conf at container creation and does not dynamically update container DNS when host DNS changes on resume.

95%

systemd-resolved stub resolver semantics (127.0.0.53) plus NetworkManager changing upstreams confuses container networking if containers attempt to bypass the stub.

60%

VPN client or NetworkManager uses per-connection DNS namespaces that are not visible to Docker default bridge-created containers.

40%

Docker embedded DNS or userland proxy has a bug around reloading DNS configuration after host network interface state changes.

20%

Suggested fixes

1

Diagnostic step 1

Confirm root cause: inspect /etc/resolv.conf inside an affected container and compare with host's /etc/resolv.conf after resume to see the mismatch.

2

Diagnostic step 2

Short-term workarounds: start containers with a fixed DNS server (--dns 1.1.1.1) or configure docker daemon's /etc/docker/daemon.json with a default DNS to avoid dependence on host resolver changes.

3

Diagnostic step 3

Better integration: run a lightweight DNS forwarder (dnsmasq or systemd-resolved on a non-loopback address) on the host bound to a stable address accessible by containers (e.g., 172.17.0.1) and point containers' DNS to that; update Docker daemon configuration to use that address as default DNS.

4

Diagnostic step 4

If using VPNs, consider starting containers after VPN is active or use --network=host for containers that must use the host resolver (note the security implications).

5

Diagnostic step 5

If persistent Docker behavior is problematic and you need dynamic DNS, consider using a container orchestrator (Podman with systemd integration or Kubernetes) that supports updating DNS settings for pods, or create a systemd unit to reload Docker containers on resume. Escalate to Docker support if you observe daemon crashes or log messages indicating a bug.