You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incorrect DNS options with host networking when buildkit is run as docker-container on a host with systemd-resolved #5009
This issue is closely related (possibly even a duplicate) to #2404 and moby/moby#41022
When BuildKit is launched as a Docker container (either via the Docker container driver or via docker run and the remote driver) with "host" networking enabled (--network=host) on a host OS using systemd-resolved the incorrect DNS settings (/etc/resolv.conf) will be passed to build containers. Specifically, instead of using the host/system DNS settings it will fallback to the default configuration:
If it detects systemd-resolved it attempts to instead read/use the file at /run/systemd/resolve/resolv.conf, however this file will not exist within the running Docker container as it is running within a mount namespace. As a result, BuildKit will fallback to the default DNS servers (Google) which may not be reachable in the environment.
As a work-around, the host resolv.conf files can be mounted into the running buildkit container which will result in a functional build environment:
With buildkitd in a container on --network=host, the 127.0.0.53 stub in /etc/resolv.conf triggered the systemd-resolved detection and BuildKit tried /run/systemd/resolve/resolv.conf, which does not exist inside the container, so builds fell back to the Google DNS defaults. Fixed by #5207, shipped in v0.16.0: in host network mode executor/oci/resolvconf.go now uses /etc/resolv.conf unconditionally and keeps 127.0.0.53, which is reachable in the shared host netns.
Closing. If this still reproduces on v0.16.0 or later, please reopen.
Activity
thaJeztah commentedon Jun 9, 2024
cc @robmry
add explicit dns nameservers to buildkitd config
add explicit dns nameservers to buildkitd config
add explicit dns nameservers to buildkitd config
add explicit dns nameservers to buildkitd config (#59)
fix: route buildkit dns through host's systemd-resolved cache
fix: route buildkit dns through host's systemd-resolved cache
crazy-max commentedon Sep 14, 2026
With buildkitd in a container on
--network=host, the127.0.0.53stub in/etc/resolv.conftriggered the systemd-resolved detection and BuildKit tried/run/systemd/resolve/resolv.conf, which does not exist inside the container, so builds fell back to the Google DNS defaults. Fixed by #5207, shipped in v0.16.0: in host network modeexecutor/oci/resolvconf.gonow uses/etc/resolv.confunconditionally and keeps127.0.0.53, which is reachable in the shared host netns.Closing. If this still reproduces on v0.16.0 or later, please reopen.