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ā€

2 Likes

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.

7 Likes

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.

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