Common causes
- Docker's internal DNS is unreachable — this can happen if the host DNS is misconfigured
- The container is using host networking mode with a broken /etc/resolv.conf on the host
- A custom Docker network with no DNS configuration, or the DNS option wasn't set
- Firewall or VPN software on the host blocking DNS traffic from reaching Docker containers
How to fix it
- Test basic DNS from a container: docker run --rm busybox nslookup google.com
- Set explicit DNS servers for Docker: add {"dns": ["8.8.8.8", "8.8.4.4"]} to /etc/docker/daemon.json, then restart Docker
- For a single container: docker run --dns 8.8.8.8 myimage
- In Docker Compose: add dns: ["8.8.8.8"] under the service definition
Example
$ docker run myapp
curl: (6) Could not resolve host: api.example.com
Temporary failure in name resolutionContainer can't reach external services because DNS isn't working inside the container
Browse more errors
The Developer Hub covers 150+ errors across Git, npm, Node.js, Python, TypeScript, and Docker — with plain-English explanations and fix steps.
