Skip to content

Image exporter with non-default platform fails #3891

@rumpl

Description

@rumpl

I am using docker 24.0.1 and have enabled the containerd image store feature.

With this Dockerfile

FROM scratch

COPY / /

If I try to build it for a platform that is not my current platform the build fails. For example I am on linux/arm64 and if I try to build an amd image I get this:

$ docker buildx build -t rumpl/test --platform=linux/amd64  .
[+] Building 0.0s (5/5) FINISHED
 => [internal] load build definition from Dockerfile                                               0.0s
 => => transferring dockerfile: 98B                                                                0.0s
 => [internal] load .dockerignore                                                                  0.0s
 => => transferring context: 2B                                                                    0.0s
 => [internal] load build context                                                                  0.0s
 => => transferring context: 1.25kB                                                                0.0s
 => CACHED [1/1] COPY / /                                                                          0.0s
 => ERROR exporting to image                                                                       0.0s
 => => exporting layers                                                                            0.0s
 => => exporting manifest sha256:12495f847e4e14c984374a13333abf65712cc8a56e57395e1dfa31f392ab2aec  0.0s
 => => exporting config sha256:71b85bc6f39a0141c5a59fea43012ae942c5fb9229bc55941cf58bd550559154    0.0s
 => => exporting attestation manifest sha256:29a43a54c9c28952fc1824c2c6f094c6dfe2f713d8e52fb12f20  0.0s
 => => exporting manifest list sha256:32dfceebd3fa6d06b49f60e42a5f672913befefa1d288e05d107dad8e55  0.0s
 => => naming to docker.io/rumpl/test:latest                                                       0.0s
 => => unpacking to docker.io/rumpl/test:latest                                                    0.0s
------
 > exporting to image:
------
ERROR: failed to solve: no match for platform in manifest sha256:32dfceebd3fa6d06b49f60e42a5f672913befefa1d288e05d107dad8e555bc0f: not found

It looks like the image exporter (the default one used when the containerd image store is enabled) is trying to only get the manifest for the current platform when unpacking:

manifest, err := images.Manifest(ctx, contentStore, img.Target, platforms.Default())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions