Skip to content

Commit e2632c5

Browse files
committed
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 9f4165c 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 <github@gone.nl>
1 parent f53bb88 commit e2632c5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

cli/command/registry.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func RegistryAuthenticationPrivilegedFunc(cli Cli, index *registrytypes.IndexInf
4343
_, _ = fmt.Fprintf(cli.Out(), "\nLogin prior to %s:\n", cmdName)
4444
authConfig, err := GetDefaultAuthConfig(cli.ConfigFile(), true, configKey, isDefaultRegistry)
4545
if err != nil {
46-
_, _ = fmt.Fprintf(cli.Err(), "Unable to retrieve stored credentials for %s, error: %s.\n", authConfigKey, err)
46+
_, _ = fmt.Fprintf(cli.Err(), "Unable to retrieve stored credentials for %s, error: %s.\n", configKey, err)
4747
}
4848

4949
select {
@@ -52,7 +52,7 @@ func RegistryAuthenticationPrivilegedFunc(cli Cli, index *registrytypes.IndexInf
5252
default:
5353
}
5454

55-
authConfig, err = PromptUserForCredentials(ctx, cli, "", "", authConfig.Username, authConfigKey)
55+
authConfig, err = PromptUserForCredentials(ctx, cli, "", "", authConfig.Username, configKey)
5656
if err != nil {
5757
return "", err
5858
}

0 commit comments

Comments
 (0)