Skip to content
Latchkey

"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.

Terminal
curl: (6) Could not resolve host: deb.debian.org
E: Temporary failure resolving 'deb.debian.org'
ping: example.com: Temporary failure in name resolution

Common 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

  1. Inspect /etc/resolv.conf for a valid, reachable nameserver.
  2. Point the container at a DNS server it can reach.
  3. Re-run a lookup to confirm resolution works.
Terminal
cat /etc/resolv.conf
# temporary check; configure DNS at the runtime level for a durable fix
getent hosts deb.debian.org

Set DNS at the container runtime level

Configure the Docker daemon or compose service with reachable DNS servers rather than editing resolv.conf by hand.

docker-compose.yml
services:
  app:
    image: debian:stable
    dns:
      - 8.8.8.8

How 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.

Frequently asked questions

What causes ""Temporary failure in name resolution""?
The container has no usable nameserver entry, or the one listed cannot be reached from its network, so every lookup fails.
How do I fix "Temporary failure in name resolution"?
Fix the container resolver

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card