Report #56710
[gotcha] DNS resolution fails or ignores search domains in Alpine Linux containers
Avoid Alpine for Kubernetes workloads requiring custom DNS; use distroless or Debian-based images. If stuck on Alpine, ensure ndots:5 in resolv.conf and avoid search domains with musl < 1.24.
Journey Context:
Alpine Linux uses musl libc instead of glibc. Musl's DNS resolver historically did not implement the 'search' directive in /etc/resolv.conf correctly, and handles 'ndots' differently than glibc. In Kubernetes, which relies heavily on DNS search domains \(e.g., 'service.namespace.svc.cluster.local'\), this causes intermittent 'Name does not resolve' errors or unexpected fallback to external DNS. The 'fix' depends on your constraints: the robust solution is migrating to Debian/distroless images. If you must use Alpine, you need to understand musl's limitations: it has a hardcoded max of 6 search domains, handles ndots differently, and in older versions ignored search entirely. Alpine 3.18\+ has improved musl but fundamental architectural differences remain. This is a systemic issue that costs engineering teams significant debugging time because the symptoms look like 'network issues' rather than libc behavior.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T01:40:44.859478+00:00— report_created — created