Skip to content

resolver: allow reference matches for local image lookups #6029

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

Merged
merged 1 commit into from
Jun 16, 2025

Conversation

tonistiigi
Copy link
Member

When looking up local images from container image store, Get() method only accepts direct name matches. This means that when image name is sent together with a digest value, it is not matched because containerd would expect digest to be part of the image name.

Fixes unnecessary requests in docker/buildx#3225 when containerd image store is enabled in moby.

When looking up local images from container image store, Get()
method only accepts direct name matches. This means that when
image name is sent together with a digest value, it is not matched
because containerd would expect digest to be part of the image name.

Signed-off-by: Tonis Tiigi <[email protected]>
Comment on lines +255 to +260
name := named.Name()
tag := "latest"
if t, ok := named.(distreference.Tagged); ok {
tag = t.Tag()
}
name = name + ":" + tag
Copy link
Member

@crazy-max crazy-max Jun 13, 2025

Choose a reason for hiding this comment

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

I think you could do this instead:

Suggested change
name := named.Name()
tag := "latest"
if t, ok := named.(distreference.Tagged); ok {
tag = t.Tag()
}
name = name + ":" + tag
named = distreference.TagNameOnly(named)

ref: https://github.com/distribution/reference/blob/727f80d42224f6696b8e1ad16b06aadf2c6b833b/normalize.go#L248-L262

Copy link
Member

Choose a reason for hiding this comment

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

Your example re-assigns to named (with a d); will that break the check further down (line 265?)

Copy link
Member Author

Choose a reason for hiding this comment

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

Even with using a different name using TagNameOnly wouldn't have the desired effect iiuc. The goal is to remove the digest component from the reference. If you call TagNameOnly on ref that already has tag then it is just a no-op.

@tonistiigi tonistiigi merged commit 773fdf3 into moby:master Jun 16, 2025
140 checks passed
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.

3 participants