Docker login, always return "unauthorized: incorrect username or password"

Ubuntu 22.04, in termianl, I type

docker login -u <myusername>

but it always return

unauthorized: incorrect username or password

I follow the link https://docs.docker.com/desktop/setup/sign-in/#credentials-management-for-linux-users
Section “Signing in with Docker Desktop for Linux” and has created the pass, and in that link, it mentions

When Docker CLI or Docker Desktop use credentials, a user prompt may pop up for the password you set during the gpg key generation.

  1. but what is “the password you set during the pgg key generation.”? when generating the pass, Ubuntu prompt me to enter passphrase to protect the key, is this that passphrase?
  2. that passphrase contains exclamation mark (!), is this the cause of error?
  3. when login docker hub, I choose “Continue with Google”, and then no need to enter any password, but I try to use my gmail password to
docker login -u <myusername>

but still fail, anyway, my gmail password also contain exclamation mark (!), is this the cause of login fail?

  1. In fact, even through browser to login docker hub, I need to use “Continue with google” to successfully login docker hub, if use username and password, I cannot login docker hub also. Is this necessary to sign up an unique docker hub account and don’t use “Continue with google” login?

I know username is not my email addresss, and I am sure the username is correct, all are lowercase and no any non-alphanumeric letter.

Finally can log in by following procedure:

  1. use “Continue with google” to login docker hub
  2. click account setting > password > reset password
  3. receive reset password email and reset password
  4. then use the new reset password to login in terminal
docker login --username={username}
  1. In Ubuntu, will prompt an dialog “Please enter the passphrase to unlock the OpenPGP secret key”, enter the passphrase (the passphrase to protect the key, not the password to login docker hub).
  2. login success!!

hope this can help others with similar problem.
Seems if using “continue with google” in browser login, cannot login docker hub in terminal.

You can use browser login via below command in your CLI

docker login

or else, check your access key permission, which you’re using in your method.

Thank you!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.