Skip to content
Latchkey

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.

Terminal
Get "https://registry.internal/v2/": dial tcp: lookup registry.internal on
127.0.0.11:53: no such host

Common 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

  1. Test the exact name with getent hosts or nslookup inside the container.
  2. Check whether it resolves against the private resolver that serves that zone.
  3. Fix the hostname, or point the container at the resolver that knows it.
Terminal
getent hosts registry.internal || nslookup registry.internal

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

docker-compose.yml
services:
  app:
    image: golang:1.22
    dns:
      - 10.0.0.2

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

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →