Credentials do not work for "docker login"

Rjak picture Rjak · Nov 29, 2016 · Viewed 9.4k times · Source

Copy/pasting my username and password into the Docker Hub website works fine.

The password is long, but does not contain shell-breaking symbols.

Copy/pasting those same credentials into command-line docker login results in an incorrect username or password error. I have tried passing the credentials interactively (both copy/pasting and typing) and through command line args, same result:

# INTERACTIVE
$ docker login
Login with your Docker ID 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.
Username: [email protected]
Password: <REDACTED>
Error response from daemon: Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password

# COMMAND LINE
$ docker login -u [email protected] -p <REDACTED>
Error response from daemon: Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password

Answer

Rjak picture Rjak · Dec 1, 2016

@mustaccio was correct.

The Docker Hub website allows you to login with either your username OR your email, and the website does not require a case-correct username.

docker login DOES require a case-correct username, and DOES NOT work with your email address.

When I signed up I chose a camel-cased username e.g.:

MyUsername

Docker forces this username to all lower case in practice. When you log in, you'll see your correct username in the upper right-hand corner of the website. In this example:

myusername

The website allows you to login with MyUsername or myusername.

docker login only allows myusername.