Open kaidjohnson opened 1 month ago
By way of communication, this issue ended up being upstream in buildkit
, which was effectively not respecting the --platform
flag for the rule checks. A PR for this has been opened ( https://github.com/moby/buildkit/pull/5371 ) and is currently a WIP! :)
Contributing guidelines
I've found a bug and checked that ...
Description
Build checks fail when a platform is specified that is not the native host platform. On an Apple M1, for example, when
--platform=linux/amd64
is set orDOCKER_DEFAULT_PLATFORM=linux/amd64
is used, the--check
flag will fail to use that platform when checkingFROM
statements.The following error is thrown:
I've created a simple reproduction to demonstrate the issue: https://github.com/kaidjohnson/buildx-check-platform-bug/tree/main
Expected behaviour
FROM
statements should be checked against the defined platform when provided.Actual behaviour
FROM
statements use the native platform, regardless ofDOCKER_DEFAULT_PLATFORM
setting or--platform
flagBuildx version
github.com/docker/buildx v0.16.2-desktop.1 081c21b9e461293ae243a1ff813a680a4f5f8fb9
Docker info
Builders list
Configuration
https://github.com/kaidjohnson/buildx-check-platform-bug/tree/main
Build logs
No response
Additional info
Building works as expected without the --check flag:
docker buildx build --platform=linux/amd64 -t test/project-b:0.1 ./projectB
OR
DOCKER_DEFAULT_PLATFORM=linux/amd64 docker buildx build --check -t test/project-b:0.1 ./projectB