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

Hello, I believe you need to add your user name with the images name before building the image

docker build -t username/imagename:latest .
docker push username/imagename

try these commands, it will solve your problem

After logout action it’s works for me.

hello from 2021, it works on my gitlab CI. thank you. i suffered hours time trying to solve this problem.
the solution from you is the registry server is placed on last line, mine was in first line " docker login index.docker.io -u user -p passw"

Thanks… This worked for me!

this worked for me… :slight_smile:
was using / in the name…

for me I login to dockerhub as a root user with sudo – su and docker login and I am able to push even using ansible to dockerhub.

Thank you you saved my life

Yeap, it makes sense.Thanks

Hi Gabriel, what worked for me was that I used my docker hub username as a part of TARGET_IMAGE name when creating tag image to be pushed to docker hub, here the example:

example:
docker tag SOURCE_IMAGE[:TAG] dockerusername/TARGET_IMAGE[:TAG]

after that push to Your repository should work fine if You logged in.

i have the same problem on ubuntu 20.04
i have tried login with docker.io : failed
i have tried logout, login, push : failed

the only difference i have is that I store my credentials on pass ,instead of storing directly in the disk, but the login process does not complains about it.

I do appreciate any advice

Perfect. It solved my problem, thanks

Thanks a lot, it works.

For me, Login Succeeded, but same error: “denied: requested access to the resource is denied”

Wow! This work! Thanks!

I cannot simply login because my organization uses SSO to login into Docker and I do not have a separate password? Any suggestions to do the login command with SSO?

It’s really helps! Thank you!

No bro,u not need to create repository . It create automatically and push its image

Switch off Docker desktop if it is on. Then run:

docker build -t hubusername/imagename:tagname -f Dockerfile .
docker login -u "hubusername" -p "password" docker.io
docker push hubusername/imagename:tagname

The same problem with new repositories only. Next push to new repository always fail. I faced the problem 1 day ago. Before it had worked well.

login success

# docker login
Authenticating with existing credentials...
Login Succeeded

Build

# docker build -t myimage:v1.0 -f Dockerfile .
...
Successfully built d330a47d4e7d
Successfully tagged myimage:v1.0

First push to new repositiry

# docker push myaccount/myimage:v1.0
The push refers to repository [docker.io/myaccount/myimage]
62192c54aab9: Pushed
e6ea1882f455: Pushed
3a626bb08c24: Mounted from library/debian
v1.0: digest: sha256:7f25c52ded98dc3acbba642a203650cd684fca4e3545c1ee8f737e9e8363985e size: 952

Second push failed. denied: requested access to the resource is denied

# docker build -t myimage:v1.1 -f Dockerfile
# docker tag myimage:v1.1 myaccount/myimage:v1.1
# docker push myaccount/myimage:v1.1
The push refers to repository [docker.io/myaccount/myimage]
62192c54aab9: Preparing
e6ea1882f455: Preparing
3a626bb08c24: Preparing
denied: requested access to the resource is denied

@atomlab I’m having the same issue started happening to me around 2AM EST. If you find a work around please share, thanks :smiley: