Go "dial tcp: lookup ... no such host" in CI
Unlike EAI_AGAIN, "no such host" is a definitive negative answer: the resolver replied that the name does not exist. In CI the real causes are a hostname typo, a name that only exists in a private DNS zone the runner cannot reach, or a container whose resolver returns NXDOMAIN because it is querying the wrong DNS server. Confirm the name and the resolver rather than retrying, because a retry will not change a definitive answer.
What this error means
A Go tool (or any client using the Go resolver) fails with "dial tcp: lookup registry.internal: no such host". The same name may resolve from the host but not inside the container.
Get "https://registry.internal/v2/": dial tcp: lookup registry.internal on
127.0.0.11:53: no such hostCommon causes
The name is a typo or does not exist
The hostname is misspelled or was never registered in any zone the runner queries, so the resolver returns NXDOMAIN.
A private name not visible to the container
The name resolves only in a private DNS zone or VPC resolver the CI container cannot reach, so it looks nonexistent.
How to fix it
Confirm the name and the resolver
- Test the exact name with
getent hostsornslookupinside the container. - Check whether it resolves against the private resolver that serves that zone.
- Fix the hostname, or point the container at the resolver that knows it.
getent hosts registry.internal || nslookup registry.internalPoint the container at the private resolver
When the name lives in a private zone, configure the container to use the DNS server that serves it.
services:
app:
image: golang:1.22
dns:
- 10.0.0.2How to prevent it
- Verify private hostnames resolve from inside the container network.
- Point containers at the resolver that serves private zones.
- Do not retry a definitive "no such host"; fix the name or the resolver.