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
... the documentation does not mention anything about my problem
... there are no open or closed issues that are related to my problem
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 or DOCKER_DEFAULT_PLATFORM=linux/amd64 is used, the --check flag will fail to use that platform when checking FROM statements.
The following error is thrown:
[+] Building 0.0s (3/3) FINISHED docker:desktop-linux
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 91B 0.0s
=> ERROR [internal] load metadata for docker.io/test/project-a:0.1 0.0s
=> Verifying build result 0.0s
=> WARN: Requested platform "linux/amd64" does not match result platform "linux/arm64" 0.0s
------
> [internal] load metadata for docker.io/test/project-a:0.1:
------
1 warning found (use docker --debug to expand):
- Requested platform "linux/amd64" does not match result platform "linux/arm64"
ERROR: test/project-a:0.1: failed to resolve source metadata for docker.io/test/project-a:0.1: no match for platform in manifest: not found
Dockerfile:1
--------------------
1 | >>> FROM test/project-a:0.1
2 | COPY example.txt example2.txt
3 |
--------------------
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 ( moby/buildkit#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
The text was updated successfully, but these errors were encountered: