Container builds on Windows 11 WSL2 frequently fail with Temporary failure in name resolution or getaddrinfo EAI_AGAIN even while host PowerShell nslookup works normally. WSL2's virtual NAT DNS stub drops forwarded UDP queries from nested Docker bridges (especially under split-tunnel VPNs), and Docker's embedded 127.0.0.11 resolver passes dead upstreams straight through.
Lab Resolver Timeout Findings (Docker Engine 27.3.1 on WSL2)
-
Runtime Divergence: Against an unreachable upstream (
--dns 192.0.2.1), Alpine (musl) and Node threwEAI_AGAINin5s, Debian (glibc) failed in10s, andnpm viewhung for85s. -
Silent Exit-0 Trap: On
debian:bookworm-slimandubuntu:24.04,apt-get updatestalled120sand exited with code0, causing chained&& apt-get installcommands to fail immediately with exit100. -
Resolver Fix: Explicit resolvers in
daemon.jsonrestored fast lookups across builds and bridge containers.
Full daemon.json, .wslconfig Fix & Compose Converter
-
Canonical Lab Guide (
daemon.jsonDNS override +dnsTunneling=true+ full runtime benchmark table): Docker DNS Resolution Failure in WSL2: EAI_AGAIN & 127.0.0.11 - Free Interactive Tool: Docker Run to Compose v2 YAML Converter
Top comments (0)