"Temporary failure in name resolution" in CI
This glibc error (EAI_AGAIN at the C library level) means the resolver could not get an answer from any configured nameserver. It surfaces from apt, curl, git, and many tools. In a CI container it almost always means /etc/resolv.conf is empty or points at a nameserver the container cannot reach. Fixing the resolver configuration resolves it across every tool at once.
What this error means
Commands fail with "Temporary failure in name resolution", for example "Could not resolve host: ...: Temporary failure in name resolution" from curl or apt inside a container.
curl: (6) Could not resolve host: deb.debian.org
E: Temporary failure resolving 'deb.debian.org'
ping: example.com: Temporary failure in name resolutionCommon causes
resolv.conf is empty or points at an unreachable server
The container has no usable nameserver entry, or the one listed cannot be reached from its network, so every lookup fails.
The container runtime did not inject DNS
A custom network or misconfigured runtime left the container without DNS, so glibc has no server to query.
How to fix it
Fix the container resolver
- Inspect
/etc/resolv.conffor a valid, reachablenameserver. - Point the container at a DNS server it can reach.
- Re-run a lookup to confirm resolution works.
cat /etc/resolv.conf
# temporary check; configure DNS at the runtime level for a durable fix
getent hosts deb.debian.orgSet DNS at the container runtime level
Configure the Docker daemon or compose service with reachable DNS servers rather than editing resolv.conf by hand.
services:
app:
image: debian:stable
dns:
- 8.8.8.8How to prevent it
- Configure DNS at the container runtime, not by editing resolv.conf inside the image.
- Verify resolution in a setup step before the first network-dependent command.
- Ensure custom container networks provide a reachable resolver.