From e2632c5c4f7537ad525b283e42253c4c8f00fceb Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 16 Jun 2025 12:05:04 +0200 Subject: [PATCH] cli/command: RegistryAuthenticationPrivilegedFunc: fix hints for login The RegistryAuthenticationPrivilegedFunc has some conditional logic to add additional hints when logging in to the default (Docker Hub) registry. Commit 9f4165ccb8873826f3f7bdc09afee1056546d294 inadvertently passed the wrong variable to PromptUserForCredentials, which caused it to show the additional hints for Docker Hub. Before this patch, hints were printed for the default (docker hub) registry; docker pull icr.io/my-ns/my-image:latest Login prior to pull: Log in with your Docker ID or email address to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com/ to create one. You can log in with your password or a Personal Access Token (PAT). Using a limited-scope PAT grants better security and is required for organizations using SSO. Learn more at https://docs.docker.com/go/access-tokens/ Username: With this patch, those hints are omitted; docker pull icr.io/my-ns/my-image:latest Login prior to pull: Username: Signed-off-by: Sebastiaan van Stijn --- cli/command/registry.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/command/registry.go b/cli/command/registry.go index de8f3254bf..4c630ff9e4 100644 --- a/cli/command/registry.go +++ b/cli/command/registry.go @@ -43,7 +43,7 @@ func RegistryAuthenticationPrivilegedFunc(cli Cli, index *registrytypes.IndexInf _, _ = fmt.Fprintf(cli.Out(), "\nLogin prior to %s:\n", cmdName) authConfig, err := GetDefaultAuthConfig(cli.ConfigFile(), true, configKey, isDefaultRegistry) if err != nil { - _, _ = fmt.Fprintf(cli.Err(), "Unable to retrieve stored credentials for %s, error: %s.\n", authConfigKey, err) + _, _ = fmt.Fprintf(cli.Err(), "Unable to retrieve stored credentials for %s, error: %s.\n", configKey, err) } select { @@ -52,7 +52,7 @@ func RegistryAuthenticationPrivilegedFunc(cli Cli, index *registrytypes.IndexInf default: } - authConfig, err = PromptUserForCredentials(ctx, cli, "", "", authConfig.Username, authConfigKey) + authConfig, err = PromptUserForCredentials(ctx, cli, "", "", authConfig.Username, configKey) if err != nil { return "", err }