Open PigeonF opened 1 month ago
remote* remote \_ remote0 \_ tcp://buildkit.internal:3375 running 4cf5e34 linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/386
Seems like your machine does not support arm architectures which is why your build fails with either remote
or default
builders. You can either append a native arm node to remote
builder or setup QEMU on your host as shown in https://docs.docker.com/build/building/multi-platform/#qemu-without-docker-desktop
The issue is not that my machine does not support ARM (I can docker buildx bake other
fine), just that other
cannot be used as the reference. That is, if I can docker buildx bake other
I would expect docker buildx bake default
to work as well.
You can check this locally by changing the platforms for mid
in
to platforms = ["linux/amd64", "linux/arm64", "linux/arm/v7"]
Oh my bad I can't read :see_no_evil:
So yes platforms need to perfectly match otherwise it fails with this error because there is no proper linking between platforms in your named context. Does it work with the following definition?:
target "default" {
dockerfile-inline = "FROM other"
contexts = {
other = "target:other"
}
platforms = [
"linux/amd64",
"linux/arm64",
"linux/arm/v7"
]
}
target "other" {
dockerfile-inline = "FROM docker.io/library/alpine:3"
platforms = [
"linux/amd64",
"linux/arm64",
"linux/arm/v7"
]
}
Maybe if a named context does not match platforms
of caller, we could override them.
Yes, the snippet you link works. The issue is that I want to build two separate targets, one of which supports more platforms than the other 😅 .
I think changing
to check if t.Platforms
is a subset of t2.Platforms
instead of equality should suffice? Or is that what you mean with there not being proper linking between named context and platforms (i.e. this check would pass, but the build would fail down the line because of some platform mismatch)?
to check if
t.Platforms
is a subset oft2.Platforms
instead of equality should suffice?
Yeah maybe a subset would be enough but wonder if should not override with platforms from caller instead per my comment https://github.com/docker/buildx/issues/2486#issuecomment-2139598586. WDYT @tonistiigi?
Contributing guidelines
I've found a bug and checked that ...
Description
When using a
target:
directive as a bakefile context in a multi-platform scenario, the platforms of the targets have to match exactly or the build fails.Expected behaviour
The build should succeed if the referencing target is built for a subset of the platforms of the referenced target.
Actual behaviour
The build fails unless the platforms match exactly.
Buildx version
github.com/docker/buildx v0.14.0
Docker info
Builders list
Configuration
Build logs
Additional info
No response