Skip to content
Latchkey

Dockerfile apt "Temporary failure resolving" in CI

apt could not resolve the mirror hostname during the build, so no index or package downloaded. This is a DNS failure inside the build network, not a missing package.

What this error means

A RUN apt-get update step fails with "Temporary failure resolving 'archive.ubuntu.com'" and "E: Some index files failed to download."

docker build
Err:1 http://archive.ubuntu.com/ubuntu jammy InRelease
  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease  Temporary failure resolving 'archive.ubuntu.com'
E: Some index files failed to download. They were ignored, or old ones used instead.

Common causes

No DNS resolver inside the build

The build network has a broken or missing resolver, so apt cannot turn the mirror hostname into an address.

Restricted egress or a missing proxy

A locked-down build network without the expected proxy cannot reach the mirror at all.

How to fix it

Configure the daemon DNS

Point the Docker daemon at working resolvers so builds inherit DNS.

/etc/docker/daemon.json
{
  "dns": ["1.1.1.1", "8.8.8.8"]
}

Provide egress or a proxy

  1. Confirm the build network can reach the mirror host.
  2. Set HTTP_PROXY/HTTPS_PROXY if a proxy is required.
  3. Retry; a transient resolver hiccup often clears on its own.

How to prevent it

  • Ensure the build network has working DNS and egress.
  • Configure daemon DNS for self-hosted runners.
  • Provide proxy settings where egress is restricted.

Frequently asked questions

What causes ""Temporary failure resolving""?
The build network has a broken or missing resolver, so apt cannot turn the mirror hostname into an address.
How do I fix "Temporary failure resolving"?
Point the Docker daemon at working resolvers so builds inherit DNS.

Related guides

References

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