Failed to authorize: failed to fetch oauth token:

Error when trying docker run hello-world:

docker: Error response from daemon: failed to resolve reference "[docker.io/library/hello-world:latest](http://docker.io/library/hello-world:latest)": failed to authorize: failed to fetch oauth token: unexpected status from GET request to https://auth.docker.io/token?scope=repository%3Alibrary%2Fhello-world%3Apull&service=registry.docker.io: 401 Unauthorized.

Please, share the output of the following commands:

docker version
docker info

When you do, use code blocks as I did. More info in our formatting guide: How to format your forum posts

Most of my students can do “docker run hello-world” immediately after installing docker Desktop but some get the “401 unauthorized” error message. I found that these students need to do “docker login -t ” and then thy can do “docker run hello-world”

After I installed Docker Desktop on a new MacBook, I got a similar response when running “docker run -d -p 8080:80 docker/welcome-to-docker”. Based on the infos in this thread I then tried “docker login -u my-user-name” (using my real username) and after that the error went away, the image was retrieved and it ran as expected.

So both of you had this in Docker Desktop. I could not reproduce it until today. Since I used Docker Desktop on macOS and Windows at the same time, I don’t remember on which one I had the issue, but In my case I had to log out actually. Then pulling images worked even when I logged in again. Non of the images you mentioned here require authentication and neither does the alpine image I tried, so it must be a bug which I think so far I only saw in Docker Desktop.

update:

I heard that it happened before and at that time it was confirmed to be a Docker Hub issue. I guess it can happen occasionally and until it is permanently fixed (if it is possible), we can log in or log out which seems to solve the issue.