compose: [BUG] `build --push` does not push when building for a single platform using a docker-container builder instance

Description

I have a fpm service in a compose.yaml file which configures both build and image. The idea is that someone can build the image and push it to GHCR and other people just have to pull it.

In the build section, I had linux/amd64 and linux/arm64 under platforms. Then docker compose build --push fpm ends with

=> [fpm] exporting to image                                                                                                                                                                                                   5.2s
 => => exporting layers                                                                                                                                                                                                        0.0s
 => => exporting manifest sha256:fbe36cfeec0a7b39fa582e8deafe7c23f8008b411d6b585494fd6f1b93115697                                                                                                                              0.0s
 => => exporting config sha256:f76708d8ac763f0f9a128f92b2150322630fe71f03e985d2ad35775eb5f738c4                                                                                                                                0.0s
 => => exporting attestation manifest sha256:1499cc8f26c8078dca5a670f6370f4a18776be47b34c06d06f9610b8da31fd2f                                                                                                                  0.0s
 => => exporting manifest sha256:a2f4f5c5825bcb633e2743bdb3e9e06db74051c2ad394f8d9ddfd64d9798d8c6                                                                                                                              0.0s
 => => exporting config sha256:0f88783b5159dca5d8e705917d6258c7d5c027151e426b4a7ea067192108daa1                                                                                                                                0.0s
 => => exporting attestation manifest sha256:35f8a1b44db2c00fdcd0cf327e6dbcb4e55d50f4f113a79bfa525c8791057026                                                                                                                  0.0s
 => => exporting manifest list sha256:d8fc9235699fe74e2f88e333cc808fa75f07508ea1418f59b87fd925bed8451c                                                                                                                         0.0s
 => => pushing layers                                                                                                                                                                                                          2.4s
 => => pushing manifest for ghcr.io/…/local/fpm:latest@sha256:d8fc9235699fe74e2f88e333cc808fa75f07508ea1418f59b87fd925bed8451c                                                                            2.7s
 => [fpm auth] …/local/fpm:pull,push token for ghcr.io

As this took some time I dropped platforms, but then docker compose build --push fpm ended with

=> [fpm] exporting to docker image format                                                                                                                                                                                     1.6s
 => => exporting layers                                                                                                                                                                                                        0.0s
 => => exporting manifest sha256:acea847c73c12a7640eb942dfebffcdf5b39d8369805e08f9e42e58527343d16                                                                                                                              0.0s
 => => exporting config sha256:0f88783b5159dca5d8e705917d6258c7d5c027151e426b4a7ea067192108daa1                                                                                                                                0.0s
 => => sending tarball                                                                                                                                                                                                         1.6s
 => [fpm fpm] importing to docker

The behavior is the same if I configure a single platform, be it linux/amd64 (mine) or linux/arm64.

docker compose push fpm always work though.

Steps To Reproduce

I’m not sure what is the cause, but in my case having a single platform under a service’s build section is enough to prevent docker compose build --push to push the image.

Compose Version

$ docker compose version
Docker Compose version 2.20.3
$ docker-compose version
Docker Compose version 2.20.3

Docker Environment

$ docker info
Client:
 Version:    24.0.6
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  0.11.2
    Path:     /usr/lib/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  2.20.3
    Path:     /usr/lib/docker/cli-plugins/docker-compose

Server:
 Containers: 22
  Running: 1
  Paused: 0
  Stopped: 21
 Images: 17
 Server Version: 24.0.6
 Storage Driver: overlay2
  Backing Filesystem: extfs
  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 logentries splunk syslog
 Swarm: inactive
 Runtimes: runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 091922f03c2762540fd057fba91260237ff86acb.m
 runc version: 
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.5.5-arch1-1
 Operating System: Arch Linux
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 14.97GiB
 Name: tekyn-hp-pavilion
 ID: 2acdbff5-9fc9-4ad4-9dc3-154527fe7756
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Anything else?

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (8 by maintainers)

Most upvoted comments

let’s indeed close this issue, as there’s anyway nothing we can do until upstream offers a way to workaround this limitation

I was able to reproduce this issue when using a docker-container builder instance, while docker build -t ndeloof/test:platform --push . succeed. I’ll investigate what’s wrong with compose way to configure buildx