Skip to content

gcrane: --platform is ignored #2059

Open
@lindeskar

Description

@lindeskar

Describe the bug

Using --platform when copying a multi-platform image with gcrane seems to have no effect. The same works as expected with crane.

To Reproduce

Copy image, select platform linux/amd64:

gcrane cp --platform linux/amd64 \
busybox:1.35.0 \
europe-west1-docker.pkg.dev/my-project/my-images/busybox:1.35.0

Get the manifest:

gcrane manifest europe-west1-docker.pkg.dev/my-project/my-images/busybox:1.35.0

This returns a manifest with mediaType: application/vnd.oci.image.index.v1+json and multiple platforms listed.

Also, pulling a different platform (linux/arm64) works fine:

docker pull --platform linux/arm64 \
europe-west1-docker.pkg.dev/my-project/my-images/busybox:1.35.0

Expected behavior

Only the selected platform is copied, like with crane.

Working example with crane

Copy image, select platform linux/amd64:

crane cp --platform linux/amd64 \
busybox:1.36.0 \
europe-west1-docker.pkg.dev/my-project/my-images/busybox:1.36.0

Get the manifest:

crane manifest europe-west1-docker.pkg.dev/my-project/my-images/busybox:1.36.0

This returns a manifest with mediaType: application/vnd.docker.distribution.manifest.v2+json.

Also, pulling a different platform (linux/arm64):

docker pull --platform linux/arm64 \
europe-west1-docker.pkg.dev/my-project/my-images/busybox:1.36.0

Returns the expected error:

image with reference europe-west1-docker.pkg.dev/my-project/my-images/busybox:1.36.0 was found but does not match the specified platform: wanted linux/arm64, actual: linux/amd64

Additional context

$ gcrane version && crane version
v0.20.3
v0.20.3

Source or target registry seems to not matter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions