π ~1 min read
Table of contents
Symptom & Impact
Containers cannot resolve hostnames, breaking outbound API and package calls.
Environment & Reproduction
Appears after host resolver changes or Docker daemon restart.
docker run --rm busybox nslookup ubuntu.com
Root Cause Analysis
Docker DNS forwarding points to stale host resolver state or unreachable nameserver.
Quick Triage
Check Docker daemon config, bridge network, and host resolver state.
systemctl status docker
cat /etc/docker/daemon.json 2>/dev/null || true
resolvectl status
Step-by-Step Diagnosis
Inspect container /etc/resolv.conf and Docker network DNS behavior.
docker network inspect bridge
docker run --rm busybox cat /etc/resolv.conf
docker run --rm busybox nslookup archive.ubuntu.com

Solution – Primary Fix
Pin known-good DNS servers in Docker daemon and restart cleanly.
Still having issues? Our IT Solutions & Services team can diagnose and resolve this for you. Get in touch for a free consultation.
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json >/dev/null <<'EOF'
{
"dns": ["1.1.1.1", "8.8.8.8"]
}
EOF
sudo systemctl restart docker

Solution – Alternative Approaches
Set DNS per compose service for workload-specific resolver needs.
docker compose config
Verification & Acceptance Criteria
Containers resolve external and internal names consistently after restart.
docker run --rm busybox nslookup ubuntu.com
docker run --rm busybox wget -qO- https://example.com >/dev/null
Rollback Plan
Restore prior daemon.json and restart Docker daemon.
sudo cp /etc/docker/daemon.json.bak /etc/docker/daemon.json
sudo systemctl restart docker
Prevention & Hardening
Standardize daemon DNS settings and test after host resolver changes.
Related Errors & Cross-Refs
Related to nftables forwarding policy and bridge MTU mismatches.
Related tutorial: View the step-by-step tutorial for Ubuntu 26.04 LTS.
View all Ubuntu 26.04 LTS tutorials on the Tutorials Hub β
Browse all common problems & solutions on the Tutorials Hub.
References & Further Reading
Docker daemon DNS configuration and Ubuntu resolver interoperability docs.
Need Expert Help?
If you cannot resolve this yourself, our team offers hands-on Server Management, Managed IT Services, and flexible Support Plans. Contact us today β we respond within one business day.