OTEL_EXPORTER_OTLP_ENDPOINT "no such host" in CI
The OTLP exporter could not resolve the hostname in OTEL_EXPORTER_OTLP_ENDPOINT: DNS returned "no such host." Unlike connection refused, the dial never even reached an IP because the name does not resolve.
What this error means
Logs show "dial tcp: lookup otel-collector on ...: no such host" or "no such host" from the exporter, and no telemetry is delivered.
failed to upload metrics: Post "http://otel-collector:4318/v1/metrics":
dial tcp: lookup otel-collector on 127.0.0.11:53: no such hostCommon causes
The service name is not resolvable from this job
A service hostname like otel-collector only resolves on the same Docker network; a job not attached to that network cannot look it up.
A typo or wrong scheme in the endpoint
A misspelled host, a missing scheme, or a stale endpoint value makes DNS resolution fail outright.
How to fix it
Use a hostname the runner can resolve
- For a service container, attach the job to the same network and use the service alias.
- For an external collector, use its real DNS name or IP.
- Re-run and confirm the lookup succeeds.
services:
otel-collector:
image: otel/opentelemetry-collector:latest
ports: ['4318:4318']
# then export to the published port:
env:
OTEL_EXPORTER_OTLP_ENDPOINT: http://localhost:4318Correct the endpoint value
Include the scheme and the exact host, e.g. http://host:4318, so DNS has a valid name to resolve.
How to prevent it
- Reference collectors by names the runner can actually resolve.
- Include the scheme and port in the OTLP endpoint.
- Use published ports on localhost when a service container is involved.