Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't return lease not found errors on platform mismatch #46293

Merged
merged 1 commit into from Aug 23, 2023

Conversation

rumpl
Copy link
Member

@rumpl rumpl commented Aug 22, 2023

- What I did

#43939 changed the signature of manifestMatchesPlatform and started returning the lease error, the issue is that, if the image for the wanted platform doesn't exist, then the lease doesn't exist either. We shouldn't return an error if the lease is not found

- How I did it

By checking the error returned when we list lease resources.

- How to verify it

With this compose file

services:
  test:
    build:
      context: .
      dockerfile: Dockerfile

And this Dockerfile:

FROM alpine

Run the compose project once:

$ docker compose up

Then run it but with a preferred platform specified:

Before:

$ DOCKER_DEFAULT_PLATFORM=linux/arm64 docker-compose up
[+] Running 0/0
 ⠋ Container compose-platform-test-1  Recreate                                                                                                                         0.0s 
Error response from daemon: lease "moby-image-sha256:e22aab0781e952e8ae9c49b2162eda23ef9a62d26a7b1e6a2d66b77f6751c45e": not found

After:

$ DOCKER_DEFAULT_PLATFORM=linux/arm64 docker-compose up
[+] Running 0/0
 ⠋ Container compose-platform-test-1  Recreate                                                                                                                         0.0s 
Error response from daemon: image with reference compose-platform-test was found but does not match the specified platform: wanted linux/arm64, actual: linux/amd64

This was reported in multiple places:

- Description for the changelog
Fixed the reported error when the local image's platform mismatches the wanted one

- A picture of a cute animal (not mandatory but encouraged)

@rumpl rumpl requested a review from vvoland August 22, 2023 11:23
@rumpl rumpl changed the title Don't return lease errors on platform mismatch Don't return lease not found errors on platform mismatch Aug 22, 2023
daemon/images/image.go Outdated Show resolved Hide resolved
If the image for the wanted platform doesn't exist then the lease
doesn't exist either. Returning this error hides the real error, so
let's not return it.

Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
Copy link
Contributor

@vvoland vvoland left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
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

@thaJeztah thaJeztah merged commit e2fc596 into moby:master Aug 23, 2023
103 checks passed
@thaJeztah
Copy link
Member

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

Successfully merging this pull request may close these issues.

None yet

3 participants