Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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

like image 670
SamDevx Avatar asked May 08 '17 22:05

SamDevx


People also ask

Can't push to Docker hub denied requested access to the resource is denied?

As the error says requested access to the resource is denied error which means you as a docker user do not have the correct rights/permission to run the docker push or any other docker command. Or you are not using the docker hub credentials correctly.

Can't push image denied requested access to the resource is denied Jenkins?

1st: you have to make sure dockerhub credentials on jenkins. 2nd: You have creat a job with pipeline project 3rd: Then you have to push your project with jenkinsfile. 4th: now you can build jenkins.


2 Answers

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!

like image 131
SamDevx Avatar answered Oct 19 '22 22:10

SamDevx


  1. First login by typing sudo docker login in the terminal. Enter username and password

  2. Visit your docker account and create a new repository. In my case I created a repository crabigator1900/dockerhub

  3. Say you have a docker image with repository name:crabigator/django and tag:latest.

In that case you will need to tag this image with a label of your wish. I decided to tag it with the label:myfirstimagepush. You tag the image by typing the command

sudo docker tag crabigator/django:latest crabigator1900/dockerhub:firstimagepush

  1. Finally push the image to your repo using the command

sudo docker push crabigator1900/dockerhub:firstimagepush

That's all there is to it.

like image 38
Crabigator360 Avatar answered Oct 20 '22 00:10

Crabigator360