Treat an uppercase first component as a registry host in split_repo_name - #3429
Open
semx wants to merge 1 commit into
Open
Treat an uppercase first component as a registry host in split_repo_name#3429semx wants to merge 1 commit into
semx wants to merge 1 commit into
Conversation
The daemon's reference grammar (distribution/reference splitDockerDomain) treats the first component of an image reference as a domain when it contains an uppercase letter, since image path components are lowercase. docker-py only checked for '.', ':' or 'localhost', so a reference like MyRegistry/image was resolved as a Hub path and the wrong registry's auth config was selected. Align split_repo_name with the daemon. Signed-off-by: semx <7532921+semx@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
split_repo_namedecides whether the first component of an image reference is a registry host or a Docker Hub path. It treated the first component as a host only when it contains.or:, or equalslocalhost.The canonical reference grammar the daemon uses (
distribution/referencesplitDockerDomain) also treats the first component as a domain when it contains an uppercase letter, because image path components are always lowercase. docker-py's detection was therefore a strict subset of the daemon's.As a result, a reference like
MyRegistry/imagewas resolved as a Docker Hub path (docker.io,MyRegistry/image) instead of the registryMyRegistry. Sinceresolve_repository_nameselects which stored credentials get attached (X-Registry-Auth) while the daemon routes on the full name, the auth config chosen did not match the registry the daemon actually contacts.This aligns
split_repo_namewith the daemon by also treating a first component containing an uppercase letter as a registry host.Before:
After:
Added unit tests for
MyRegistry/imageandMyRegistry/username/image; existingResolveRepositoryNameTestcases still pass.