Conversation
…#105) Private-registry pulls were always sent unauthenticated because pullOpts() left RegistryAuth empty. The Docker daemon does not fall back to its own credential store when the header is explicitly absent — it treats the call as anonymous, so pulls fail with 401 even when docker pull succeeds. resolveRegistryAuth (image/dockerconfig.go) now reads ~/.docker/config.json and follows the same lookup chain as the Docker CLI: per-registry credHelpers first, then the global credsStore, then inline auths. Credential helpers are invoked via the docker-credential-<name> subprocess interface, which covers osxkeychain, desktop, ecr-login, and any other compliant helper. Encoding delegates to authconfig.Encode from github.com/moby/moby/api/pkg/authconfig — the canonical encoder whose decoder the daemon uses for X-Registry-Auth.
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.
Summary
pullOpts()leftRegistryAuthempty. The Docker daemon does not fall back to its own credential store when the header is absent — it treats the call as anonymous, so pulls fail with 401 even whendocker pullof the same reference succeeds.resolveRegistryAuth(newimage/dockerconfig.go) reads~/.docker/config.jsonand follows the same lookup chain as the Docker CLI: per-registrycredHelpersfirst, then the globalcredsStore, then inlineauthstokens. Credential helpers are invoked via thedocker-credential-<name>subprocess interface, coveringosxkeychain,desktop,ecr-login, and any other compliant helper.authconfig.Encodefromgithub.com/moby/moby/api/pkg/authconfig— the canonical encoder the daemon'sX-Registry-Authdecoder is the exact inverse of.Test plan
image/dockerconfig_test.gocover: missing config file, inline auth round-trip, no matching entry, missingcredsStorehelper fallback to inline auths, per-registrycredHelperswith missing helpergo test ./...) passes on pushlayerx ci localhost:5001/private/testimage:latestnow pulls and analyses successfully with stored credentialsCloses #105