Skip to content

Add fallback for pull by tag#41749

Merged
AkihiroSuda merged 1 commit intomoby:masterfrom
cpuguy83:fallback_manifest_store
Dec 5, 2020
Merged

Add fallback for pull by tag#41749
AkihiroSuda merged 1 commit intomoby:masterfrom
cpuguy83:fallback_manifest_store

Conversation

@cpuguy83
Copy link
Member

@cpuguy83 cpuguy83 commented Dec 3, 2020

Some registries seem to be non-conformant and return a not found error
when pulling by digest (which docker now does all the time).
To work around this, fallback when all of the following are true:

  1. Image reference is a tag
  2. Tag->digest resolution succeeds
  3. Fetch by resolved digest fails with a "not found" error.

This is intentionally not caching the manifests to reduce complexity for
this edge case.

Closes #41687

Copy link
Member Author

Choose a reason for hiding this comment

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

Happy to change message to whatever...

Copy link
Member

Choose a reason for hiding this comment

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

Should it continue looping, or pick the first error? I recall we had some code similar in https://github.com/moby/moby/blob/master/errdefs/http_helpers.go#L157 which was based on code from the distribution packages

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't see why we wouldn't look at all the returned errors in this case.

@tiborvass
Copy link
Contributor

Let's make sure docker pull alpine:latest@sha256:... does not go through fallback.

@cpuguy83
Copy link
Member Author

cpuguy83 commented Dec 3, 2020

@tiborvass It's not, however the error message wasn't quite right since we always set the "error after falling back" regardless if we fell back at all.
Fixed this.

@cpuguy83 cpuguy83 force-pushed the fallback_manifest_store branch from 15249d1 to ae44307 Compare December 3, 2020 22:28
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, thanks!

@thaJeztah
Copy link
Member

@tianon @tiborvass good to go?

Copy link
Contributor

Choose a reason for hiding this comment

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

typo in specification. Also wonder if we should point out what's missing in the spec. https://github.com/docker/distribution/blob/master/docs/spec/api.md#pulling-an-image

Some registries seem to be non-conformant and return a not found error
when pulling by digest (which docker now does all the time).
To work around this, fallback when all of the following are true:

1. Image reference is a tag
2. Tag->digest resolution succeeds
3. Fetch by resolved digest fails with a "not found" error.

This is intentionally not caching the manifests to reduce complexity for
this edge case.

Signed-off-by: Brian Goff <[email protected]>
@cpuguy83 cpuguy83 force-pushed the fallback_manifest_store branch from ae44307 to 495d623 Compare December 4, 2020 23:51
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.

[docker.pkg.github.com] Docker pull is not working on 20.10 RC1

5 participants