"docker buildx bake" not push multiplatform to registry

Hi, I’m using docker desktop on Apple Silicon M1.

I’m trying to use Docker Buildx Bake to build images, and they are all multiplatform images (arm64,amd64).
I point out that they use directly “docker buildx build … --platform linux/amd64,linux/arm64” it works without problems and in the registry I find the same image with both architectures available.

I’m starting to use “bake” to exploit its potential, but it seems that it doesn’t push with both architectures, but I find only the first one defined in the list “platforms = [“linux/arm64”,“linux/amd64”]”, now I find the “arm64” architecture, and if I invert them, I find only “amd64”.

Below I report my configuration and the build command.
The build of both architectures is done but only the first one is pushed to the registry.

    group "default" {
        targets = [
            "test-nginx"
        ]
    }

    variable "shared_args" {
        default = {
            REGISTRY="myregistry/team-ri"
        }
    }

    target "test-nginx" {
        context = "../"
        dockerfile = "./Dockerfiles/test-nginx"
        tags = ["${shared_args.REGISTRY}/test-nginx:latest"]
        platforms = ["linux/arm64","linux/amd64"]
        output = ["type=registry"]
   }
docker buildx bake test-nginx 
[+] Building 17.2s (21/21) FINISHED                                                                                                    docker:desktop-linux
 => [internal] load build definition from test-nginx                                                                                                    0.0s
 => => transferring dockerfile: 702B                                                                                                                   0.0s
 => [linux/arm64 internal] load metadata for docker.io/nginxinc/nginx-unprivileged:bookworm-perl                                                       1.2s
 => [linux/amd64 internal] load metadata for docker.io/nginxinc/nginx-unprivileged:bookworm-perl                                                       1.2s
 => [auth] nginxinc/nginx-unprivileged:pull token for registry-1.docker.io                                                                             0.0s
 => [internal] load .dockerignore                                                                                                                      0.1s
 => => transferring context: 2B                                                                                                                        0.0s
 => [linux/amd64 1/6] FROM docker.io/nginxinc/nginx-unprivileged:bookworm-perl@sha256:39b32e6580042fa1cdd8723c272c26feac6dff2d0e3abaf4ca5c0a6737bab38  0.0s
 => => resolve docker.io/nginxinc/nginx-unprivileged:bookworm-perl@sha256:39b32e6580042fa1cdd8723c272c26feac6dff2d0e3abaf4ca5c0a6737bab38f             0.0s
 => [linux/arm64 1/6] FROM docker.io/nginxinc/nginx-unprivileged:bookworm-perl@sha256:39b32e6580042fa1cdd8723c272c26feac6dff2d0e3abaf4ca5c0a6737bab38  0.0s
 => => resolve docker.io/nginxinc/nginx-unprivileged:bookworm-perl@sha256:39b32e6580042fa1cdd8723c272c26feac6dff2d0e3abaf4ca5c0a6737bab38f             0.0s
 => [internal] load build context                                                                                                                      0.0s
 => => transferring context: 345B                                                                                                                      0.0s
 => CACHED [linux/arm64 2/6] COPY --chown=nginx:root Dockerfiles/utils/test-nginx/proxy_sets.conf /etc/nginx/proxy_sets.conf                            0.0s
 => CACHED [linux/arm64 3/6] COPY --chown=nginx:root Dockerfiles/utils/test-nginx/dhparam.pem /etc/ssl/certs/dhparam.pem                                0.0s
 => CACHED [linux/arm64 4/6] WORKDIR /etc/nginx/templates                                                                                              0.0s
 => CACHED [linux/arm64 5/6] COPY --chown=nginx:root Dockerfiles/utils/test-nginx/default.conf.template /etc/nginx/templates/default.conf.template      0.0s
 => CACHED [linux/arm64 6/6] WORKDIR /etc/nginx                                                                                                        0.0s
 => CACHED [linux/amd64 2/6] COPY --chown=nginx:root Dockerfiles/utils/test-nginx/proxy_sets.conf /etc/nginx/proxy_sets.conf                            0.0s
 => CACHED [linux/amd64 3/6] COPY --chown=nginx:root Dockerfiles/utils/test-nginx/dhparam.pem /etc/ssl/certs/dhparam.pem                                0.0s
 => CACHED [linux/amd64 4/6] WORKDIR /etc/nginx/templates                                                                                              0.0s
 => CACHED [linux/amd64 5/6] COPY --chown=nginx:root Dockerfiles/utils/test-nginx/default.conf.template /etc/nginx/templates/default.conf.template      0.0s
 => CACHED [linux/amd64 6/6] WORKDIR /etc/nginx                                                                                                        0.0s
 => exporting to image                                                                                                                                 6.5s
 => => exporting layers                                                                                                                                0.0s
 => => exporting manifest sha256:bb411e8547dc5f5dee883b5e3e8374b2d826b2622e4b033f1d78a704d8213740                                                      0.0s
 => => exporting config sha256:ac24a7a9130f1bcd290f2066451978069133e8f4ad384e31b7085afcf873f030                                                        0.0s
 => => exporting attestation manifest sha256:91982ee3df1cf4971fb56251009944f2591f4d7318f029059cb82b94c1eabce1                                          0.0s
 => => exporting manifest sha256:52d430c125ee3af1eeb0a214ba5db410996565b79608fb232bd94f552f949ba3                                                      0.0s
 => => exporting config sha256:06cfd2aed70959ef81fad55b8941168b3716b4fe009d0431bc945105d8f132e0                                                        0.0s
 => => exporting attestation manifest sha256:596b99bc9494a351909b981b762f7dc7c036a0823c0de2c844d1073d36f7821a                                          0.0s
 => => exporting manifest list sha256:1b1bc8346cab0e416eb594cf6e72bd2b170b3c35a4e19a79db54adab146d4dda                                                 0.0s
 => => naming to myregistry/team-ri/test-nginx:latest                                                                                        0.0s
 => => unpacking to myregistry/team-ri/test-nginx:latest                                                                                     0.0s
 => => pushing layers                                                                                                                                  3.9s
 => => pushing manifest for myregistry/team-ri/test-nginx:latest@sha256:1b1bc8346cab0e416eb594cf6e72bd2b170b3c35a4e19a79db54adab146d4dda     2.3s
 => [auth] team-ri/test-nginx:pull,push token for hub.docker.hpecorp.net                                                                                 0.0s
 => pushing myregistry/team-ri/test-nginx:latest with docker                                                                                 4.6s
 => => pushing layer 11daa0b242e2                                                                                                                      4.5s
 => => pushing layer 63f005c23fcf                                                                                                                      4.5s
 => => pushing layer 6a74c9c99a41                                                                                                                      4.5s
 => => pushing layer 67a81010326b                                                                                                                      4.5s
 => => pushing layer 790facd12f38                                                                                                                      4.5s
 => => pushing layer ed5348a8c109                                                                                                                      4.5s
 => => pushing layer 78f3fb170bbb                                                                                                                      4.5s
 => => pushing layer 6c249a1215e3                                                                                                                      4.5s
 => => pushing layer 19a821968632                                                                                                                      4.5s
 => => pushing layer 781931fc4095                                                                                                                      4.5s
 => => pushing layer 09b1426e7e82                                                                                                                      4.5s
 => => pushing layer b24250f862d7                                                                                                                      4.5s
 => => pushing layer 654212a1ea3d                                                                                                                      4.5s
 => => pushing layer ecfbfd72ce38                                                                                                                      4.5s
 => => pushing layer bda8ead29f10                                                                                                                      4.5s
 => => pushing layer 4f4fb700ef54                                                                                                                      4.5s
 => => pushing layer 91dd5c25c39b                                                                                                                      4.5s
 => => pushing layer d51c377d94da                                                                                                                      4.5s
 => => pushing layer 36af18e7311e                                                                                                                      4.5s
 => => pushing layer 8ea11555e890                                                                                                                      4.5s
 => => pushing layer 3a8cb4a965d3                                                                                                                      4.5s
 => => pushing layer b4f23b55d2d5                                                                                                                      4.5s
 => => pushing layer fa6a0d960b2c                                                                                                                      4.5s
 => => pushing layer 23bd0d32ea0c                                                                                                                      4.5s
 => => pushing layer ef266f35471a                                                                                                                      4.5s
 => => pushing layer 46cbc9b0a7c9                                                                                                                      4.5s
 => => pushing layer db959b5c062b                                                                                                                      4.5s
 => => pushing layer 7cf63256a31a                                                                                                                      4.5s

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/2n5hfkpgeqxfkwpluw5truudr

If you think it’s a bug, it’s probably best to check and report at buildx Github.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.