-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Open
Labels
Description
Contributing guidelines and issue reporting guide
- I've read the contributing guidelines and wholeheartedly agree. I've also read the issue reporting guide.
Well-formed report checklist
- I have found a bug that the documentation does not mention anything about my problem
- I have found a bug that there are no open or closed issues that are related to my problem
- I have provided version/information about my environment and done my best to provide a reproducer
Description of bug
Bug description
When you specify a --platform in the Dockerfile that does not match the host runner platform, the override is not propagated to:
TARGETPLATFORMarg- pushed manifest list platform os/arch property
For example my host runner is amd64:
➜ uname -a
Linux earth 6.18.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 24 Jan 2026 00:47:39 +0000 x86_64 GNU/Linuxbut when you build an arm64 image:
$ echo '
FROM --platform=linux/arm64 alpine
ARG BUILDPLATFORM
ARG TARGETPLATFORM
RUN set -x && uname -a && env | grep PLATFORM
' | docker buildx build -f - . -t 10.10.20.30:5044/arm --push --no-cache --progress=plain
...
#5 [2/2] RUN set -x && uname -a && env | grep PLATFORM
#5 0.060 + uname -a
#5 0.072 Linux buildkitsandbox 6.18.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 24 Jan 2026 00:47:39 +0000 aarch64 Linux
#5 0.075 + env
#5 0.076 + grep PLATFORM
#5 0.091 BUILDPLATFORM=linux/amd64
#5 0.092 TARGETPLATFORM=linux/amd64
#5 DONE 0.1s
...
#6 exporting config sha256:3129b921ca4b16c081b12b423fdedffea6e4f17b78531937a886a8e0dcccec5f done
#6 exporting manifest list sha256:60d6f9b5f25165b45b667dcbd9608e51a99fe0730048c2791ed8741b22fb41c2 done
note:
unamereportsaarch64build so the runtime of the container is definitelyarm64as expectedTARGETPLATFORMis stilllinux/amd64which is not expected
In addition if the pushed image is inspected in the registry:
➜ docker buildx imagetools inspect --raw localhost:5044/arm:latest@sha256:60d6f9b5f25165b45b667dcbd9608e51a99fe0730048c2791ed8741b22fb41c2
{
"schemaVersion": 2,
"mediaType": "application/vnd.oci.image.index.v1+json",
"manifests": [
{
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"digest": "sha256:85d5ffcb8bdafe9be72ff2d5d5cca3d6a8ed253882eb15ea979c5e972ae1a3a5",
"size": 668,
"platform": {
"architecture": "amd64",
"os": "linux"
}
},
{
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"digest": "sha256:c56dd93f794bd95598119461ec062efafbe0780fa410049a6c7b0fd62f0a78a5",
"size": 566,
"annotations": {
"vnd.docker.reference.digest": "sha256:85d5ffcb8bdafe9be72ff2d5d5cca3d6a8ed253882eb15ea979c5e972ae1a3a5",
"vnd.docker.reference.type": "attestation-manifest"
},
"platform": {
"architecture": "unknown",
"os": "unknown"
}
}
]
}The reported platform is amd64 which is wrong. That can be confirmed by inspecting the pushed image config object which shows arm64 as expected:
➜ docker buildx imagetools inspect --raw 10.10.20.30:5044/arm:latest@sha256:3129b921ca4b16c081b12b423fdedffea6e4f17b78531937a886a8e0dcccec5f | jq '{os, architecture}'
{
"os": "linux",
"architecture": "arm64"
}Further this discrepancy is confirmed by attempting to pull the image with specific --platform:
➜ docker pull localhost:5044/arm --platform=linux/arm64
Using default tag: latest
latest: Pulling from arm
no matching manifest for linux/arm64 in the manifest list entries
But pulling the image without --platform and then checking its config arch confirms its actually an arm64 image:
➜ docker pull localhost:5044/arm
...
Using default tag: latest
Digest: sha256:60d6f9b5f25165b45b667dcbd9608e51a99fe0730048c2791ed8741b22fb41c2
Status: Downloaded newer image for localhost:5044/arm:latest
➜ docker run -it --rm localhost:5044/arm uname -m
aarch64
Related issues
I found very similar #5677 but there are some diffs:
- this is reproducible with a single architecture build (not multi-platform)
TARGETPLATFORMis incorrect- platform pushed in manifest list is wrong
Reproduction
See above.
Version information
➜ uname -a
Linux earth 6.18.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 24 Jan 2026 00:47:39 +0000 x86_64 GNU/Linux
➜ docker version
Client:
Version: 29.2.1
API version: 1.53
Go version: go1.25.6 X:nodwarf5
Git commit: a5c7197d72
Built: Thu Feb 5 10:59:55 2026
OS/Arch: linux/amd64
Context: default
Server:
Engine:
Version: 29.2.1
API version: 1.53 (minimum version 1.44)
Go version: go1.25.6 X:nodwarf5
Git commit: 6bc6209b88
Built: Thu Feb 5 10:59:55 2026
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v2.2.1
GitCommit: dea7da592f5d1d2b7755e3a161be07f43fad8f75.m
runc:
Version: 1.4.0
GitCommit:
docker-init:
Version: 0.19.0
GitCommit: de40ad0
➜ docker buildx version
github.com/docker/buildx 0.31.0 44945d71ff077ce7fc142fbdee6acec8d9acb630
➜ docker info
Client:
Version: 29.2.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: 0.31.0
Path: /usr/lib/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: 5.0.2
Path: /usr/lib/docker/cli-plugins/docker-compose
Server:
Containers: 13
Running: 13
Paused: 0
Stopped: 0
Images: 420
Server Version: 29.2.1
Storage Driver: overlay2
Backing Filesystem: btrfs
Supports d_type: true
Using metacopy: true
Native Overlay Diff: false
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
CDI spec directories:
/etc/cdi
/var/run/cdi
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: dea7da592f5d1d2b7755e3a161be07f43fad8f75.m
runc version:
init version: de40ad0
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.18.7-arch1-1
Operating System: Arch Linux
OSType: linux
Architecture: x86_64
CPUs: 12
Total Memory: 62.51GiB
Name: earth
ID: 2de7fd2d-9d55-4cd8-a4dd-c5c3d39714f0
Docker Root Dir: /var/lib/docker
Debug Mode: false
Username: crashappsec
Experimental: false
Insecure Registries:
localhost:5044
::1/128
127.0.0.0/8
Live Restore Enabled: false
Firewall Backend: iptablesReactions are currently unavailable