-
Notifications
You must be signed in to change notification settings - Fork 503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
After Update to Docker 25.0.0 (buildx v0.12.1), host-gateway in build does not work anymore #2201
Comments
This error looks to come from Lines 75 to 83 in d852568
Possibly related to this PR (which was in the v0.12.1 update of buildx); In the meantime, you can try downgrading Let me transfer this ticket to the buildx issue tracker. |
Actually, that PR looks a lot older, so probably not related; might've been a follow-up somewhere 🤔 |
Hm... looking at the code for buildx/driver/docker/driver.go Lines 112 to 127 in d852568
This may be something in the engine (not setting the label by default?); On Docker Desktop; docker buildx inspect default
Name: default
Driver: docker
Last Activity: 2023-11-21 14:51:38 +0000 UTC
Nodes:
Name: default
Endpoint: default
Status: running
Buildkit: v0.12.4+3b6880d2a00f
Platforms: linux/arm64, linux/amd64, linux/amd64/v2, linux/riscv64, linux/ppc64le, linux/s390x, linux/mips64le, linux/mips64
Labels:
org.mobyproject.buildkit.worker.containerd.namespace: moby
org.mobyproject.buildkit.worker.containerd.uuid: 1cc22aa9-1955-4d97-96a7-b6153b61614b
org.mobyproject.buildkit.worker.executor: containerd
org.mobyproject.buildkit.worker.hostname: docker-desktop
org.mobyproject.buildkit.worker.moby.host-gateway-ip: 192.168.65.254
org.mobyproject.buildkit.worker.network: host
org.mobyproject.buildkit.worker.selinux.enabled: false
org.mobyproject.buildkit.worker.snapshotter: overlayfs On a debian machine; docker buildx inspect default
Name: default
Driver: docker
Last Activity: 2024-01-22 11:09:41 +0000 UTC
Nodes:
Name: default
Endpoint: default
Status: running
Buildkit: v0.12.4+3b6880d2a00f
Platforms: linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/386
Labels:
org.mobyproject.buildkit.worker.moby.host-gateway-ip: <nil> |
With docker 24.0.7 I get the correct label:
|
Label is set here; and it looks like it gets the information from func getLabels(opt Opt, labels map[string]string) map[string]string {
if labels == nil {
labels = make(map[string]string)
}
labels[wlabel.HostGatewayIP] = opt.DNSConfig.HostGatewayIP.String()
return labels
} Edit: that code was added in moby/moby@21e50b8 Either it needs a fallback, or it's depending on the gateway-address to be set, which may not yet be the case at that point (done through setHostGatewayIP: https://github.com/moby/moby/blob/178651733852a26bc11e6fa272b48ff37ecc7447/daemon/daemon_unix.go#L897-L910
The gateway IP is set when initializing the network controller, which happens somehwere in |
There are other issues around DNS with Docker 25, like docker/cli#4816 (comment) |
As a workaround you can manually configure the IP-address to use; https://docs.docker.com/engine/reference/commandline/dockerd/#configure-host-gateway-ip. I see the docs only mentions the For example; cat /etc/docker/daemon.json {
"host-gateway-ip": "172.17.0.1"
} After that, make sure to restart the daemon to reload the config (also something we should look if we can do so on "reload" (note to self)); systemctl restart docker
docker builder inspect default
Name: default
Driver: docker
Last Activity: 2024-01-22 11:09:41 +0000 UTC
Nodes:
Name: default
Endpoint: default
Status: running
Buildkit: v0.12.4+3b6880d2a00f
Platforms: linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/386
Labels:
org.mobyproject.buildkit.worker.moby.host-gateway-ip: 172.17.0.1 |
cc @dvdksn for the documentation 😅 |
I'm fine staying with 24.x for now, just wanted to let you know that this did break with 25.0.0. |
@thaJeztah the docs above do mention |
Thanks for the quick reaction! I can confirm that this is now correctly working with 25.0.1. |
It still doesn't work with the |
Description
When building an image with the parameter
--add-host=host.docker.internal:host-gateway
, the build is aborted with the following message:Reproduce
docker build --add-host=host.docker.internal:host-gateway .
Expected behavior
The docker build works.
docker version
Client: Docker Engine - Community Version: 25.0.0 API version: 1.44 Go version: go1.21.6 Git commit: e758fe5 Built: Thu Jan 18 17:09:59 2024 OS/Arch: linux/amd64 Context: default Server: Docker Engine - Community Engine: Version: 25.0.0 API version: 1.44 (minimum version 1.24) Go version: go1.21.6 Git commit: 615dfdf Built: Thu Jan 18 17:09:59 2024 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.27 GitCommit: a1496014c916f9e62104b33d1bb5bd03b0858e59 runc: Version: 1.1.11 GitCommit: v1.1.11-0-g4bccb38 docker-init: Version: 0.19.0 GitCommit: de40ad0
docker info
Additional Info
I rolled back to 24.0.7 and everything works again.
The text was updated successfully, but these errors were encountered: