docker push error "denied: requested access to the resource is denied"

SamDevx picture SamDevx · May 9, 2017 · Viewed 29.2k times · Source

This error occurs when trying to push an image to the public repository on Docker Hub. There have been no issues with other registries I have tried.

I have looked at numerous sites, blogs including StackOverflow and there is still no clear answer.

You can try to replicate this issue as follows.

Image on local host

As shown in the screenshot above, I have an image aspc-mvc-app on local docker host. As shown, it has 3 tags - 1.0.5, 1.0.5.latest and latest.

Assume that we are trying to push using an account name of janedoe at Docker Hub

Per documentation on Docker.io and numerous other sites, there are 3 steps to pushing.

(1) Login

docker login "index.docker.io" -u janedoe -p <password>

--> I get Login Succeeded which is good!

(2) Add one or more tags

Of the 3 tags, let's just tag the latest.

docker tag janedoe/aspc-mvc-app:latest janedoe/aspc-mvc-app

--> The prompt returns with no error. So far so good.

(3) Push

docker push janedoe/aspc-mvc-app

--> This is where the error occurs.

As shown on the screenshot below, initial checks seem to occur fine until you get the error denied: requested access to the resource is denied

enter image description here

At step (2), I have tried numerous other formats including the following.

docker tag janedoe/aspc-mvc-app:latest janedoe/aspc-mvc-app:latest
docker tag janedoe/aspc-mvc-app janedoe/aspc-mvc-app:latest

docker tag aspc-mvc-app:latest janedoe/aspc-mvc-app
docker tag aspc-mvc-app janedoe/aspc-mvc-app:latest

docker tag 306a8fd79d88 janedoe/aspc-mvc-app
docker tag 306a8fd79d88 janedoe/aspc-mvc-app:latest

All fail with the same error.

As a comparison, with the same exact image, I had no problem pushing to Azure Container Registry.

Since Docker Hub is so popular, can anyone shed light on what the mystery is, or if there is a detailed documentation anywhere?

Updated 5/9/2017

I am fairly up-to-date on docker cli and server versions. Right now, my cli is 17.05.0-ce-rc1 and server is 17.04.0-ce as shown below.

enter image description here

Answer

SamDevx picture SamDevx · May 9, 2017

The solution is simply to change the way of logging in at step (1).

docker login -u janedoe -p <password>

Everything else can stay the way described above. The image was successfully pushed to Docker Hub!