Skip to content

Treat an uppercase first component as a registry host in split_repo_name - #3429

Open
semx wants to merge 1 commit into
docker:mainfrom
semx:fix-uppercase-registry-auth
Open

Treat an uppercase first component as a registry host in split_repo_name#3429
semx wants to merge 1 commit into
docker:mainfrom
semx:fix-uppercase-registry-auth

Conversation

@semx

@semx semx commented Aug 5, 2026

Copy link
Copy Markdown

split_repo_name decides 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 equals localhost.

The canonical reference grammar the daemon uses (distribution/reference splitDockerDomain) 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/image was resolved as a Docker Hub path (docker.io, MyRegistry/image) instead of the registry MyRegistry. Since resolve_repository_name selects 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_name with the daemon by also treating a first component containing an uppercase letter as a registry host.

Before:

>>> auth.resolve_repository_name('MyRegistry/image')
('docker.io', 'MyRegistry/image')

After:

>>> auth.resolve_repository_name('MyRegistry/image')
('MyRegistry', 'image')

Added unit tests for MyRegistry/image and MyRegistry/username/image; existing ResolveRepositoryNameTest cases still pass.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant