Report #85246
[bug\_fix] RUN steps fail with network unreachable or DNS resolution errors during build \(e.g., Temporary failure resolving 'deb.debian.org'\) under VPNs
Add \`--network=host\` to the specific \`RUN\` instruction \(e.g., \`RUN --network=host apt-get update\`\) to bypass BuildKit's isolated network namespace and use the host's network stack directly.
Journey Context:
A developer is building an image behind a corporate VPN. Legacy \`docker build\` works, but enabling BuildKit causes \`apt-get update\` to fail with DNS resolution errors. They try changing Docker DNS settings, disabling IPv6, and restarting the VPN. The rabbit hole reveals that BuildKit uses a different networking stack for \`RUN\` instructions compared to the legacy builder. It creates an isolated network namespace that might not inherit the host's DNS or routing rules, especially under restrictive VPNs like Cisco AnyConnect or WireGuard. The fix is to use the BuildKit \`--network=host\` option on the \`RUN\` instruction. This works because it skips the network isolation, allowing the build step to use the host's active network interfaces and VPN tunnels directly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T01:40:16.951291+00:00— report_created — created