apt "Temporary failure resolving" a mirror in CI
apt tried to resolve a package mirror hostname and DNS did not answer, so it reports a temporary failure resolving that host. The mirror may be fine; name resolution inside the container or runner failed at that moment.
What this error means
apt-get update or install fails with "Err: ... Temporary failure resolving 'archive.ubuntu.com'" and "Some index files failed to download".
Err:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Temporary failure resolving 'archive.ubuntu.com'
E: Some index files failed to download. They have been ignored,
or old ones used instead.Common causes
DNS is unreachable from the container
The container has no working resolver or the resolver timed out, so apt cannot turn the mirror name into an IP.
Egress or proxy config blocks the mirror
If apt must go through a proxy that is unset, resolution or connection to the public mirror fails.
How to fix it
Fix resolution and retry
- Check
/etc/resolv.confinside the container has a reachable nameserver. - Verify the mirror resolves with
getent hosts. - Re-run
apt-get updateonce DNS answers.
getent hosts archive.ubuntu.com || cat /etc/resolv.conf
apt-get updatePoint apt at the proxy when egress requires it
If the network requires a proxy, configure apt to use it so it can reach the mirror.
Acquire::http::Proxy "http://proxy.corp.example:8080";
Acquire::https::Proxy "http://proxy.corp.example:8080";How to prevent it
- Give job containers a reliable resolver rather than an empty resolv.conf.
- Configure apt proxy settings when the runner network requires egress via a proxy.
- Use an internal mirror reachable from the runner network when possible.