62

I'm just getting started with docker. I'm following the instructions specified here https://docs.docker.com/windows/step_one/

I installed docker (1.10.2) on windows 10 & ran docker run hello-world . But, I'm getting an authentication error while the tutorial doesn't mentioned anything about it.

Here's the message I received.

$ docker run hello-world
Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Authentication is required: Get https://registry-1.docker.io/v2/library/hello-world/manifests/latest: unauthorized: incorrect username or password.
See 'C:\Program Files\Docker Toolbox\docker.exe run --help'.

I searched google & here, but couldn't find anything similar to this error message.

Thanks!

Vishwa
  • 1,525
  • 2
  • 13
  • 25

10 Answers10

134

Please run docker login at first time when you run any other docker commands.

You can log into any public or private repository for which you have credentials. When you log in, the command stores encoded credentials in $HOME/.docker/config.json on Linux or%USERPROFILE%/.docker/config.json on Windows.

BMW
  • 42,880
  • 12
  • 99
  • 116
  • 8
    That Worked! Thanks. I wonder why they didn't mention a word about it in the documentation. – Vishwa Feb 26 '16 at 06:06
  • 1
    you can raise an issue to https://github.com/docker/docker/tree/master/docs and if you want to help, you can raise pull request to merge your fix to this open source project. – BMW Feb 26 '16 at 06:08
  • Sure. Will check it out. – Vishwa Feb 26 '16 at 06:12
  • But, should "docker login" be required prior to "docker run hello-world"? I have just tried this on a freshly installed Mac. I could run "docker run hello-world" without any "docker login" command prior to that. – OlavT Apr 04 '17 at 08:29
  • 1
    I worked through K Scott Allen's tutorial on this without encountering a problem. However docker login has helped me subsequently. – Kirsten Jul 09 '17 at 21:02
  • 50
    Just had this problem, `docker login` solved it, but login failed with my full email as ID. Had to enter only username (MacOS Sierra) – jomar Jul 15 '17 at 03:01
  • 1
    For me the credential error occured even when doing docker login with right credentials. (First performed docker login, executed hello-world 3 times. and it worked. Then after som time, tried hello-world, it stated that I need to login. And then the same error shows then trying to login) – Andreas Mattisson Aug 10 '17 at 06:23
  • I tried docker login then docker run hello-world. It prompts for password. I pasted my docker password in on the terminal and then it shows the same error: Error response from daemon: Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password – 2myCharlie Jul 14 '18 at 16:18
  • 3
    Got it working now...when it shows: Username (user-name@domain.com): type in the user name and then it'll prompt for the password. – 2myCharlie Jul 14 '18 at 21:07
  • 1
    "docker login" did the trick , just remember that username is not same as email id, that was this silly mistake i was doing – ShankPossible May 15 '19 at 08:47
  • It worked, thanks. Just use 'username' and 'password' that you used in 'hub.docker.com'. – Ibrahim Sakaci Oct 20 '20 at 08:14
38

If you login through your emailId it does not works.

On windows login using your docker hub id. enter image description here

You can access by your username.

Kumar Abhishek
  • 3,004
  • 33
  • 29
13

Probably it can happen if you were logged in before, by console or by kitematic.

You can try docker logout if you want use docker without auth.

In this case Authentication is required: shouldn't appear again.

Zipfer
  • 174
  • 1
  • 6
5

I have solved this issue in macOS Mojave (version : 10.14.3)

docker login

Login with your username not email id then its working fine.

enter image description here

Nanhe Kumar
  • 15,498
  • 5
  • 79
  • 71
4

On macOS you need to login from the commandline using

docker login

Also you must use your username and not your email

4

on ubuntu:

docker login

so if you don't know your username password, you probably haven't created one. what you should do, is go and create an id on docker visit: official docker webpage

just like any other github accout ,they will ask you for the username, provide one and they will authenticate same as github, once done , put your email and password. verify it and you are now good to go.

ok! now coming to the point... if you were facing the problem like the problem statement , just do

docker login 

enter username and password, that you just provided . you will be displayed ,"LOGIN succeeded"

now run this command

docker run hello-world

beware of the dash '-' sign , i myself stuck with this issue, and you are done.

thanks:)

3

run docker login to execute any other docker commands. or just logout if you want to use public hubs docker logout

Murtaza Hussain
  • 3,851
  • 24
  • 30
2

For worked trying docker logout and then docker login with the proper credentials

weig
  • 23
  • 3
1

For those who logged in via their email address associated with their account during the Docker desktop installation process - this problem seems to occur because the terminal has also stored those credentials, but for some reason it only accepts login's via your actual username.

If you go to DockerHub you should see it in the upper right corner.

Try running docker login with that username, and you should be all set!

docker login

# username from dockerhub
# the same password
Mark Pieszak - Trilon.io
  • 61,391
  • 14
  • 82
  • 96
0

Setting my vNAT for docker dns server to 8.8.8.8 resolved my issue on windows just try might help thanks

Sanu
  • 31
  • 4