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."
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.
{
"dns": ["1.1.1.1", "8.8.8.8"]
}Provide egress or a proxy
- Confirm the build network can reach the mirror host.
- Set
HTTP_PROXY/HTTPS_PROXYif a proxy is required. - 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.