16

When I tried to run

$ docker run -it ubuntu /bin.bash

I got the following error:

Unable to find image 'ubuntu:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/library/ubuntu/manifests/latest: unauthorized: incorrect username or password.
See 'docker run --help'.

Why am I getting an auth error when the ubuntu image is public?

alexwlchan
  • 5,699
  • 7
  • 38
  • 49
Dancrumb
  • 26,597
  • 10
  • 74
  • 130

7 Answers7

28

Docker for Windows --

repro docker pull redis

I received this error recently. My solution turned out to be doing a docker logout, which seemed to clear the credential entry slot related to docker hub (speculation). After this, my docker pull redis worked fine.

Randy Larson
  • 6,817
  • 2
  • 18
  • 13
  • 1
    Thanks - in my case I had multiple internal repos so had to logout of each one docker logout url.to.intenal.corp.repo – SidJ May 07 '21 at 06:26
15

This issue could be caused by being signed into Docker on your machine.

Signout of Docker, the following screenshot is from a Windows machine, you see will a Signout option if you are signed in.

enter image description here

Brian Ogden
  • 18,439
  • 10
  • 97
  • 176
8

It turns out that Docker checks authentication before it checks what permissions are needed for the image in question.

Thus, if you have bad auth details in ~/.docker/config.json, your request will be flatly rejected. Fix or remove the bad record and you'll be good to go!

Dancrumb
  • 26,597
  • 10
  • 74
  • 130
  • I found out that simply the existence of a Docker credential manager that does not support your setup can cause this error. I use SSH to connect to a server with Docker for Windows. I had to delete/rename all files that start with `docker-credential-` in `C:\Program Files\Docker\Docker\resources\bin` for pulling a public image to work. – Jesper Kristensen Sep 26 '22 at 08:26
7

The issue is when you login with your email id as your username. To resolve this:

1) Check what your user id is in the right upper corner: https://hub.docker.com/

2) In your terminal:

  • docker logout
  • docker login (Put in the username as obtained above)
Erika Dsouza
  • 1,015
  • 12
  • 8
2

This wored for me: Try to login in command line

$ docker logout
$ docker login

Be aware that logging in on the commandline requires your username, NOT email address

Source: https://github.com/docker/hub-feedback/issues/1098

Tarek El-Mallah
  • 4,015
  • 1
  • 31
  • 46
0

Check for docker id in Docker Hub in the upper right corner. You can log in with both email id and docker id. This issue comes when you do it with your email id.

0

I restart my Docker and run pull then it works

Jason Huang
  • 179
  • 1
  • 3