Skip to content

[27.x backport] Touch-up some errors for missing platforms#48691

Merged
thaJeztah merged 4 commits intomoby:27.xfrom
vvoland:48631-27.x
Oct 18, 2024
Merged

[27.x backport] Touch-up some errors for missing platforms#48691
thaJeztah merged 4 commits intomoby:27.xfrom
vvoland:48631-27.x

Conversation

@vvoland
Copy link
Copy Markdown
Contributor

@vvoland vvoland commented Oct 18, 2024

NOTE: last 2 commits are reworked so they can be applied to the 27.x branch

PushImage: remove misleading error about --platform without containerd

Without containerd store enabled, we were discarding underlying errors,
and instead informing the user that --platform is not suported;

docker pull --quiet --platform=linux/riscv64 alpine:latest
docker image push --platform=linux/amd64 alpine:latest
Error response from daemon: graphdriver backed image store doesn't support multiplatform images

However, that's not the case; platform filtering works, but if the image
is not the right platform, the push fails (which is the same as would
happen with the containerd image store enabled).

docker image push --platform=linux/amd64 alpine:latest
Error response from daemon: image with reference docker.io/library/alpine:latest was found but does not match the specified platform: wanted linux/amd64, actual: linux/riscv64

When specifying the platform and that platform matches, it finds the image,
and the push continue;

docker image push --platform=linux/riscv64 alpine:latest
The push refers to repository [docker.io/library/alpine]
3fd4750fd687: Layer already exists
...

(The above example obviously fails because I don't have permissions to
push official images).

images: GetImage: touch-up error message for missing platform

Slightly touching up the error message, because the "wanted/actual" output
felt too much like a assertion failure in a test-case.

  • Format the image-reference using "familiar" format, which shows the
    image's short name for official images.
  • Move the actual and requested platforms to be a part of the sentence,
    but within braces.

Before this patch:

docker image push --platform=linux/amd64 alpine:latest
Error response from daemon: image with reference docker.io/library/alpine:latest was found but does not match the specified platform: wanted linux/amd64, actual: linux/riscv64

With this patch:

docker image push --platform=linux/amd64 alpine:latest
Error response from daemon: image with reference alpine:latest was found but its platform (linux/riscv64) does not match the specified platform (linux/amd64)

daemon/containerd: touch-up platform not found error

- Changed "match" to "provide", in an attempt to indicate that the image is
  a multi-platform image that doesn't contain the given platform.
- Remove the "wanted" and instead make the requested platforms to be a part
  of the sentence, but within braces.

Before this patch:

    docker pull --quiet --platform=linux/riscv64 alpine:latest
    docker image history --platform=linux/amd64 alpine
    Error response from daemon: image with reference alpine:latest was found but does not match the specified platform: wanted linux/amd64

With this patch:

    docker pull --quiet --platform=linux/riscv64 alpine:latest
    docker image history --platform=linux/amd64 alpine
    Error response from daemon: image with reference alpine:latest was found but does not provide the specified platform (linux/amd64)

daemon/containerd: getPushDescriptor: fix formatting of platform in errors

The platform was printed in its raw format, which didn't produce a very
readable output;

Before this change:

    $ docker image push --platform=linux/amd64 alpine:arm64
    Error response from daemon: no suitable image manifest found for platform {amd64 linux [] }

After this change:

    $ docker image push --platform=linux/amd64 alpine:arm64
    Error response from daemon: no suitable image manifest found for platform linux/amd64

thaJeztah and others added 4 commits October 18, 2024 13:48
Without containerd store enabled, we were discarding underlying errors,
and instead informing the user that `--platform` is not suported;

    docker pull --quiet --platform=linux/riscv64 alpine:latest
    docker image push --platform=linux/amd64 alpine:latest
    Error response from daemon: graphdriver backed image store doesn't support multiplatform images

However, that's not the case; platform filtering works, but if the image
is not the right platform, the push fails (which is the same as would
happen with the containerd image store enabled).

    docker image push --platform=linux/amd64 alpine:latest
    Error response from daemon: image with reference docker.io/library/alpine:latest was found but does not match the specified platform: wanted linux/amd64, actual: linux/riscv64

When specifying the platform and that platform matches, it finds the image,
and the push continue;

    docker image push --platform=linux/riscv64 alpine:latest
    The push refers to repository [docker.io/library/alpine]
    3fd4750fd687: Layer already exists
    ...

(The above example obviously fails because I don't have permissions to
push official images).

Signed-off-by: Sebastiaan van Stijn <[email protected]>
(cherry picked from commit d31c241)
Signed-off-by: Paweł Gronowski <[email protected]>
Slightly touching up the error message, because the "wanted/actual" output
felt too much like a assertion failure in a test-case.

- Format the image-reference using "familiar" format, which shows the
  image's short name for official images.
- Move the actual and requested platforms to be a part of the sentence,
  but within braces.

Before this patch:

    docker image push --platform=linux/amd64 alpine:latest
    Error response from daemon: image with reference docker.io/library/alpine:latest was found but does not match the specified platform: wanted linux/amd64, actual: linux/riscv64

With this patch:

    docker image push --platform=linux/amd64 alpine:latest
    Error response from daemon: image with reference alpine:latest was found but its platform (linux/riscv64) does not match the specified platform (linux/amd64)

Signed-off-by: Sebastiaan van Stijn <[email protected]>
(cherry picked from commit 8681b3c)
Signed-off-by: Paweł Gronowski <[email protected]>
- Changed "match" to "provide", in an attempt to indicate that the image is
  a multi-platform image that doesn't contain the given platform.
- Remove the "wanted" and instead make the requested platforms to be a part
  of the sentence, but within braces.

Before this patch:

    docker pull --quiet --platform=linux/riscv64 alpine:latest
    docker image history --platform=linux/amd64 alpine
    Error response from daemon: image with reference alpine:latest was found but does not match the specified platform: wanted linux/amd64

With this patch:

    docker pull --quiet --platform=linux/riscv64 alpine:latest
    docker image history --platform=linux/amd64 alpine
    Error response from daemon: image with reference alpine:latest was found but does not provide the specified platform (linux/amd64)

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Paweł Gronowski <[email protected]>
…rrors

The platform was printed in its raw format, which didn't produce a very
readable output;

Before this change:

    $ docker image push --platform=linux/amd64 alpine:arm64
    Error response from daemon: no suitable image manifest found for platform {amd64 linux [] }

After this change:

    $ docker image push --platform=linux/amd64 alpine:arm64
    Error response from daemon: no suitable image manifest found for platform linux/amd64

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Signed-off-by: Paweł Gronowski <[email protected]>
@vvoland vvoland added status/2-code-review kind/bugfix PR's that fix bugs containerd-integration Issues and PRs related to containerd integration area/ux labels Oct 18, 2024
@vvoland vvoland added this to the 27.4.0 milestone Oct 18, 2024
@vvoland vvoland self-assigned this Oct 18, 2024
@vvoland vvoland requested a review from thaJeztah October 18, 2024 12:33
@thaJeztah
Copy link
Copy Markdown
Member

Thank you! I marked this as "supersedes #48632", which was my initial backport that I needed to update ❤️

Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/ux containerd-integration Issues and PRs related to containerd integration kind/bugfix PR's that fix bugs status/2-code-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants