Docker Community Forums

Share and learn in the Docker community.

Docker push - Error - requested access to the resource is denied


(Gabriel de Oliveira Estevam) #1

Can someone help me with the following problem?

First I logged in to Docker by executing the command:

$ docker login

It includes the registered user and password, but without problems when sending an image to the Docker Hub. When I run the following command:

$ docker push projetofinal2_web

The following error occurs:

The push refers to a repository [docker.io/library/projetofinal2_web]
6e2e1155d419: Preparing 
1cb633a23e71: Preparing 
6b91dd5a05f0: Preparing 
7dc8d752af64: Preparing 
af8b16133eb3: Preparing 
27951393f8e7: Waiting 
f89067d6e30e: Waiting 
5129f19da2c9: Waiting 
34929ec591c4: Waiting 
e02b32b1ff99: Waiting 
f75e64f96dbc: Waiting 
8f7ee6d76fd9: Waiting 
c23711a84ad4: Waiting 
90d1009ce6fe: Waiting 
denied: requested access to the resource is denied

I have verified that the projetofinal2_web image actually exists using the command:

$ docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
projetofinal2_web   latest              c27ee5582377        17 minutes ago      983MB
<none>              <none>              082bd1514477        28 hours ago        918MB
<none>              <none>              148f5843aabb        2 days ago          981MB
<none>              <none>              ac09ab02e2f3        2 days ago          981MB
postgres            latest              f9b577fb1ed6        6 days ago          311MB
python              3.6.7               1ec4d11819ad        2 weeks ago         918MB

Project in GitHub: https://github.com/gabrieldeoliveiraestevam/projeto?files=1


(Jedihomer Townend) #2

Make sure your logging into the right area… I had this using GitLab’s CI, each docker login passed but the push failed.

I changed the process to do this, and it solved it for me…

docker login -u "myusername" -p "mypassword" docker.io
docker push myusername/myimage:0.0.1

I also added myusername as a contributer to by docker hub repo. I’m not sure whether or not this final step is needed as I was trying everything at the time to get it to work.


(Gabriel de Oliveira Estevam) #3

Then I must execute the command below?

$ docker login -u "myusername" -p "mypassword" docker.io
$ docker push projetofinal2_web 

I did not understand why in your case you informed myusername / myimage: 0.0.1. What does 0.0.1 mean?

Before doing PUSH should I create the repository in the Docker Hub?

Thank you!


(Jedihomer Townend) #4

The main point was telling docker login which repository to login to. Then you need to push to your repository, which is usually username/image.

In my case I had an image tagged as version 0.0.1, so that was what I was pushing.

Off the top of my head, I can’t remember whether pushing no tag version automatically tags it latest, as I’ve always versioned with numbers.

What you’ve written may work, or you may have to include your username as part of the push…


(Gabriel de Oliveira Estevam) #5

Got it,

The timing is not as powerful as the command.

Previously, you did not need to create a repository in the Docker Hub with the name projetofinal2_web ?

As below:


(Jedihomer Townend) #6

So in that scenario I’d probably have:

docker build -t gabrieldeoliveiraest/projetofinal2_web:latest -f Dockerfile .
docker login -u "gabrieldeoliveiraest" -p "password" docker.io
docker push gabrieldeoliveiraest/projetofinal2_web:latest

I.e, build and tag the image, login to docker, then push the created image to docker.io.