[BUG] docker compose build doesn't tag when multiple platforms specified
Description
docker compose build doesn't tag when multiple platforms specified.
docker compose up --build does, as does docker compose create --build
Steps To Reproduce
Run the following command should tag both images, but fails to tag the one with multiple platforms.
~ % docker compose build
...
[+] Building 2/2
✔ issue-902-problem Built 0.0s
✔ issue-902-working Built 0.0s
~ % docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
issue-902-working latest f7d4e76cbf1e 6 months ago 6.02MB
~ %
Note that if I remove all images and instead use this command, both images are tagged properly:
~ % docker compose up --build
...
[+] Running 5/5
✔ issue-902-problem Built 0.0s
✔ issue-902-working Built 0.0s
✔ Network main_default Created 0.0s
✔ Container issue-902-problem Created 0.1s
✔ Container issue-902-working Created 0.1s
Attaching to issue-902-problem, issue-902-working
issue-902-problem exited with code 0
issue-902-working exited with code 0
~ % docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
issue-902-problem latest 854512a7e492 6 months ago 6.02MB
issue-902-working latest 854512a7e492 6 months ago 6.02MB
~ %
Here are the contents to reproduce:
problem.Dockerfile
FROM busybox
working.Dockerfile
FROM busybox
docker-compose.yaml
services:
issue-902-problem:
container_name: issue-902-problem
build:
dockerfile: problem.Dockerfile
platforms:
- linux/amd64
- linux/arm64
image: issue-902-problem:latest
issue-902-working:
container_name: issue-902-working
build:
dockerfile: working.Dockerfile
image: issue-902-working:latest
Compose Version
Docker Compose version v2.33.1-desktop.1
Docker Environment
Client:
Version: 28.0.1
Context: desktop-linux
Debug Mode: false
Plugins:
ai: Docker AI Agent - Ask Gordon (Docker Inc.)
Version: v0.9.4
Path: /Users/redacted/.docker/cli-plugins/docker-ai
buildx: Docker Buildx (Docker Inc.)
Version: v0.21.1-desktop.2
Path: /Users/redacted/.docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.33.1-desktop.1
Path: /Users/redacted/.docker/cli-plugins/docker-compose
debug: Get a shell into any image or container (Docker Inc.)
Version: 0.0.38
Path: /Users/redacted/.docker/cli-plugins/docker-debug
desktop: Docker Desktop commands (Beta) (Docker Inc.)
Version: v0.1.5
Path: /Users/redacted/.docker/cli-plugins/docker-desktop
dev: Docker Dev Environments (Docker Inc.)
Version: v0.1.2
Path: /Users/redacted/.docker/cli-plugins/docker-dev
extension: Manages Docker extensions (Docker Inc.)
Version: v0.2.27
Path: /Users/redacted/.docker/cli-plugins/docker-extension
feedback: Provide feedback, right in your terminal! (Docker Inc.)
Version: v1.0.5
Path: /Users/redacted/.docker/cli-plugins/docker-feedback
init: Creates Docker-related starter files for your project (Docker Inc.)
Version: v1.4.0
Path: /Users/redacted/.docker/cli-plugins/docker-init
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
Version: 0.6.0
Path: /Users/redacted/.docker/cli-plugins/docker-sbom
scout: Docker Scout (Docker Inc.)
Version: v1.16.3
Path: /Users/redacted/.docker/cli-plugins/docker-scout
Server:
Containers: 6
Running: 4
Paused: 0
Stopped: 2
Images: 15
Server Version: 28.0.1
Storage Driver: overlayfs
driver-type: io.containerd.snapshotter.v1
Logging Driver: json-file
Cgroup Driver: cgroupfs
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: bcc810d6b9066471b0b6fa75f557a15a1cbf31bb
runc version: v1.2.4-0-g6c52b3f
init version: de40ad0
Security Options:
seccomp
Profile: unconfined
cgroupns
Kernel Version: 6.10.14-linuxkit
Operating System: Docker Desktop
OSType: linux
Architecture: aarch64
CPUs: 10
Total Memory: 31.29GiB
Name: docker-desktop
ID: 46593c18-765b-4e8b-8ee2-774587396981
Docker Root Dir: /var/lib/docker
Debug Mode: false
HTTP Proxy: http.docker.internal:3128
HTTPS Proxy: http.docker.internal:3128
No Proxy: hubproxy.docker.internal
Labels:
com.docker.desktop.address=unix:///Users/redacted/Library/Containers/com.docker.docker/Data/docker-cli.sock
Experimental: false
Insecure Registries:
hubproxy.docker.internal:5555
::1/128
127.0.0.0/8
Live Restore Enabled: false
WARNING: daemon is not using the default seccomp profile
Anything else?
Thanks for all your work on this amazing tool.
Couldn't reproduce it with Docker Compose version v2.34.0-desktop.1.
docker compose build
Compose can now delegate builds to bake for better performance.
To do so, set COMPOSE_BAKE=true.
[+] Building 0.2s (12/12) FINISHED
...
[+] Building 2/2
✔ issue-902-problem Built 0.0s
✔ issue-902-working Built
docker images images
issue-902-working latest 2898c3558bf3
issue-902-problem latest 8861f2bdf5eb
I just tried updating but got same issue:
docker compose version
Docker Compose version v2.34.0-desktop.1
...
docker images | grep 902
issue-902-working latest c9d862be732c 6 months ago 6.02MB
I can't reproduce either:
$ docker compose build issue-902-problem
Compose can now delegate builds to bake for better performance.
To do so, set COMPOSE_BAKE=true.
[+] Building 2.8s (9/9) FINISHED docker:desktop-linux
=> [issue-902-problem internal] load build definition from problem.Dockerfile 0.0s
=> => transferring dockerfile: 58B 0.0s
=> [issue-902-problem linux/arm64 internal] load metadata for docker.io/library/busybox:latest 1.8s
=> [issue-902-problem linux/amd64 internal] load metadata for docker.io/library/busybox:latest 1.8s
...
=> [issue-902-problem] exporting to image 0.9s
=> => naming to docker.io/library/issue-902-problem:latest 0.0s
=> => unpacking to docker.io/library/issue-902-problem:latest 0.4s
=> [issue-902-problem] resolving provenance for metadata file 0.0s
[+] Building 1/1
✔ issue-902-problem Built 0.0s
$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
issue-902-problem latest ea4fa4aeaa8e 6 months ago 8.17MB
Can you try running with COMPOSE_BAKE=true to check same issue applies to bake ?
Not sure if you guys were both on Mac arm or not, but I'll have some other Mac arm, colleagues test, and get back to you tomorrow
Hey @solvingj
Yes we're on Mac arm. Did you get any feedback from your colleagues?
upgraded to v.2.34.0 to test this, I seem to see the same as @solvingj
Brians-Laptop:docker_issue arm64646$ docker compose version
Docker Compose version v2.34.0-desktop.1
Brians-Laptop:docker_issue arm64646$ docker compose build
Brians-Laptop:docker_issue arm64646$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
issue-902-working latest 94faca61c574 6 months ago 4.04MB
Brians-Laptop:docker_issue arm64646$ docker compose up --build
Brians-Laptop:docker_issue arm64646$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
issue-902-working latest 94faca61c574 6 months ago 4.04MB
issue-902-problem latest bafa7c6c8404 6 months ago 4.04MB
@glours yes, @euroinexile is a colleague
Linux (Ubuntu 24.04) , not seeing this issue either if it matters
Client: Docker Engine - Community
Version: 28.0.4
API version: 1.48
Go version: go1.23.7
Git commit: b8034c0
Built: Tue Mar 25 15:07:16 2025
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 28.0.4
API version: 1.48 (minimum version 1.24)
Go version: go1.23.7
Git commit: 6430e49
Built: Tue Mar 25 15:07:16 2025
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.27
GitCommit: 05044ec0a9a75232cad458027ca83437aae3f4da
runc:
Version: 1.2.5
GitCommit: v1.2.5-0-g59923ef
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Docker Compose version v2.34.0
I'm seeing this issue this week as well. Linux Mint 21.3 Virginia
Client: Docker Engine - Community
Version: 28.1.1
API version: 1.49
Go version: go1.23.8
Git commit: 4eba377
Built: Fri Apr 18 09:52:10 2025
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 28.1.1
API version: 1.49 (minimum version 1.24)
Go version: go1.23.8
Git commit: 01f442b
Built: Fri Apr 18 09:52:10 2025
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.7.27
GitCommit: 05044ec0a9a75232cad458027ca83437aae3f4da
runc:
Version: 1.2.5
GitCommit: v1.2.5-0-g59923ef
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Docker Compose version v2.35.1
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I reproduce the bug behavior also. Build reports it built and tagged 2 images. But docker image ls and docker inspect do not see the multiplatform image.
- Docker Desktop Windows Version 4.49.0 (208700)
- with its included Docker Compose version v2.40.2-desktop.1
$ docker compose build
[+] Building 2.1s (13/13) FINISHED
=> [internal] load local bake definitions 0.0s
=> => reading from stdin 1.18kB 0.0s
=> [issue-902-working internal] load build definition from working.Dockerfile 0.0s
=> => transferring dockerfile: 58B 0.0s
=> [issue-902-problem internal] load build definition from problem.Dockerfile 0.0s
=> => transferring dockerfile: 58B 0.0s
=> [issue-902-problem linux/amd64 internal] load metadata for docker.io/library/busybox:latest 0.8s
=> [issue-902-problem linux/arm64 internal] load metadata for docker.io/library/busybox:latest 0.8s
=> [issue-902-problem internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> CACHED [issue-902-working 1/1] FROM docker.io/library/busybox:latest@sha256:e3652a00a2fabd16ce889f0aa32c38eec347b997e73bd09e69c962ec7f8732ee 0.0s
=> => resolve docker.io/library/busybox:latest@sha256:e3652a00a2fabd16ce889f0aa32c38eec347b997e73bd09e69c962ec7f8732ee 0.0s
=> CACHED [issue-902-problem linux/arm64 1/1] FROM docker.io/library/busybox:latest@sha256:e3652a00a2fabd16ce889f0aa32c38eec347b997e73bd09e69c962ec7f8732ee 0.0s
=> => resolve docker.io/library/busybox:latest@sha256:e3652a00a2fabd16ce889f0aa32c38eec347b997e73bd09e69c962ec7f8732ee 0.0s
=> [issue-902-working] exporting to oci image format 0.2s
=> => exporting layers 0.0s
=> => exporting manifest sha256:324ff5a09ef5656f03c13d3e88e3b80b33cad5e708c5b7ec579b2afd4bbc0c71 0.0s
=> => exporting config sha256:bb75a677d72b3b410eec99f7261502a9414cc259099bf2433ca939ef01f4c2e9 0.0s
=> => sending tarball 0.1s
=> [issue-902-problem] exporting to image 0.1s
=> => exporting layers 0.0s
=> => exporting manifest sha256:bfa80a7221070fa390a136473a510563915290c555768f88649bdfabe5c88e12 0.0s
=> => exporting config sha256:959bdc41269ac75a3207689cbafa31b2bb823a63f93983379792b024ab2d9a99 0.0s
=> => exporting attestation manifest sha256:0251280c1f39e266c04abc6f1a024bce4bd6ed59b99158494477632b364ba377 0.0s
=> => exporting manifest sha256:d1e9cc75cef5e7adf1bf19bee0682e1a2ceb6b5717c4dd88505bde6ea78a9035 0.0s
=> => exporting config sha256:6ff604da085b538eebe9811772c5c17428395b2c9b3753484c85881bd19884cd 0.0s
=> => exporting attestation manifest sha256:6599c50415d7ff9dce769501a2c32526f9ad7bfa963541a7634a7f75ad28ef9c 0.0s
=> => exporting manifest list sha256:3427493fb98a173f03e1fe98bebca7f2e67ee3ef173ea282aa63d40009cd12cf 0.0s
=> importing to docker 0.0s
=> [issue-902-problem] resolving provenance for metadata file 0.0s
=> [issue-902-working] resolving provenance for metadata file 0.0s
[+] Building 2/2
✔ issue-902-working:latest Built 0.0s
✔ issue-902-problem:latest Built
$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
[redacted...]
issue-902-working latest 324ff5a09ef5 13 months ago 6.78MB
amazon/amazon-ecs-local-container-endpoints latest 2f1be750a040 2 years ago 277MB
$ docker inspect issue-902-problem:latest
[]
Error: No such object: issue-902-problem:latest
$ docker inspect issue-902-working:latest
[
{
"Id": "sha256:324ff5a09ef5656f03c13d3e88e3b80b33cad5e708c5b7ec579b2afd4bbc0c71",
"RepoTags": [
"issue-902-working:latest"
],
"RepoDigests": [
"issue-902-working@sha256:324ff5a09ef5656f03c13d3e88e3b80b33cad5e708c5b7ec579b2afd4bbc0c71"
],
"Parent": "",
"Comment": "",
"Created": "2024-09-26T21:31:42Z",
"DockerVersion": "",
"Author": "",
"Architecture": "amd64",
"Os": "linux",
"Size": 2214758,
"GraphDriver": {
"Data": null,
"Name": "overlayfs"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:e14542cc062958c3bfada9c260a6ae47bb2906fd8b514999774760710dbce3cb"
]
},
"Metadata": {
"LastTagTime": "2025-10-29T17:11:47.299842401Z"
},
"Descriptor": {
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"digest": "sha256:324ff5a09ef5656f03c13d3e88e3b80b33cad5e708c5b7ec579b2afd4bbc0c71",
"size": 480,
"annotations": {
"io.containerd.image.name": "docker.io/library/issue-902-working:latest",
"org.opencontainers.image.created": "2025-10-29T17:11:47Z",
"org.opencontainers.image.ref.name": "latest"
}
},
"Config": {
"Cmd": [
"sh"
],
"Entrypoint": null,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Labels": {
"com.docker.compose.project": "dockerbug12700",
"com.docker.compose.service": "issue-902-working",
"com.docker.compose.version": "2.40.2"
},
"OnBuild": null,
"User": "",
"Volumes": null,
"WorkingDir": ""
}
}
]
This issue has been automatically marked as not stale anymore due to the recent activity.
I can't reproduce with latest codebase:
$ docker compose build
...
[+] build 2/2
✔ Image issue-902-problem:latest Built 1.1s
✔ Image issue-902-working:latest Built 1.1s
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
issue-902-working latest 0d9f41313419 13 months ago 6.21MB
issue-902-problem latest 4e895f0bd1be 13 months ago 8.43MB
I assume as Compose now uses Bake to manage the build we have better support for the many corner case in multi-image/multi-platforms image management.