docker / hub-feedback

Feedback and bug reports for the Docker Hub
https://hub.docker.com
235 stars 39 forks source link

push fails: 'denied: requested access to the resource is denied' #1222

Closed drewmullen closed 4 years ago

drewmullen commented 7 years ago

solution: https://github.com/docker/hub-feedback/issues/1222#issuecomment-591599629

Expected behavior

docker should push the image to public docker hub registry

Actual behavior

$ docker push drewmullen/tc-common The push refers to a repository [docker.io/drewmullen/tc-common] c6d78ef51be8: Preparing cf516324493c: Preparing denied: requested access to the resource is denied

Information

Verified repo is public (https://hub.docker.com/r/drewmullen/tc-common/)

Docker for Mac: version: 17.06.2-ce-mac27 (4cdec4294a50b2233146b09469b49937dabdebdd) macOS: version 10.12.6 (build: 16G29) logs: /tmp/FF32B403-4A84-4923-BBAB-9D08CD3B10E3/20171025-145959.tar.gz [OK] db.git [OK] vmnetd [OK] dns [OK] driver.amd64-linux [OK] virtualization VT-X [OK] app [OK] moby [OK] system [OK] moby-syslog [OK] db [OK] env [OK] virtualization kern.hv_support [OK] slirp [OK] osxfs [OK] moby-console [OK] logs [OK] docker-cli [OK] menubar [OK] disk Failure: Could not upload diagnostic data to remote server (docker-diagnose exit code is 1)

Steps to reproduce the behavior

  1. git clone https://github.com/docker-teamcenter/tc-common/blob/master/Dockerfile
  2. docker build -t tc-common .
  3. docker tag <container-id> drewmullen/tc-common
  4. docker login (successful)
  5. docker push drewmullen/tc-common
maheshmore2691 commented 5 years ago

I guess it's too late to reply but still posting it in case someone struggling around it. I had the same issue and I resolved it by following below steps.

1. docker build -t sample . 2. docker login -u yourusername -p yourpassword 3. docker tag <imageid> yourDockerHubUserName/priavteRepositoryName: <newTagName> (This step will map your existing image to docker hub repository) 4. docker push yourDockerUserName/privateRepository:<tagName>

I hope this will help to resolve the issue.

ales-blaze commented 5 years ago

I am facing the issue , i was trying to implement CI/CD on monolithic java web application , i am having windows 2012 R2 Datacenter azure vm , i have jenkins installed on the windows vm and i am using maven to push docker images to docker hub and i am having aws amazon linux also , which have docker installed in it. so in order to build and push my docker images , i am accessing docker remotely on my windows vm from amazon linux and maven builds my project but when it comes to push built image to docker hub it gives the same error. Please help me with it ASAP!

if i perform steps : docker login : logged in successfully docker push : push successfully.

but i want to do it through maven , as i am using docker-maven-plugin to push my changes docker hub , i am not using jenkins " post build step" thing

TheCarver-254 commented 5 years ago

HEY, GUYS, I FOUND A FIX FOR THIS !!!!! first, log out from docker at the terminal using docker logout then follow the following instructions $ docker login $ docker tag yourusername/example-node-app yourdockerhubusername/example-node-app:v1 $ docker push javieracosta/example-node-app:v1

remember to put your correct docker hub credentials

HOPE IT WORKS

miry commented 5 years ago

@MicahAcosta I used the same hint. But for my case, i required to input credentials on each push.

My problem was have 2 secrets store solutions provided: Mac Os keychain and local docker config. I disabled in Docker on mac ability to use MacOs Keychain, and use only one local docker config.

hantmac commented 5 years ago

OK the problem is solved!

username in docker push arnoldnonsotp/match_microservice was wrong.

Yes, When we build the image, the image should be username/reponame, or will be denied

bidhutdhakal commented 5 years ago

where ever you push it from, make sure you put 'sudo' before push, that solves all issues.

ingenuity2k commented 5 years ago

a simple docker login solved the issue for me.

jasonbronson commented 5 years ago

I was copying the container name not the id...opps. Don't do that.

MohanrajBabu commented 5 years ago

Faced similar issue, below fixed mine docker login -u "username" -p "password" docker.io sudo docker push imagename

tuxedo0801 commented 5 years ago

docker login stores the user. Had a login with a different user before. So docker logout removed the user-session and a new login with a push then worked.

sunilkumar1003 commented 5 years ago

Docker CLI error getting the above error when trying to login to Docker. I have deleted the config.json file and also restarted the docker service but no luck. I am running Linux Mint as Docker host

tuxedo0801 commented 5 years ago

Had the same issue again. docker logout did not help. When I skip the param for user/pass on CLI and enter it interactively, it works.

pwfilehost commented 4 years ago

tried all these solution and none of them worked then tried : docker login -u "username" -p "password" docker.io && docker push personalhub/reponame:latest it worked and only thing changed was lining those two commands. It doesn't make sense and all similar issue below suggest dockerhub need to sort this crap out. I can't get those hours back - ever!

svw26 commented 4 years ago
docker login -u "username" -p "password" docker.io && docker push personalhub/reponame:latest

Thank you @pwfilehost ! This worked for me (I'm using a Mac, if that was the problem). Finally. Ridiculous how much time i've wasted on this...

pwfilehost commented 4 years ago

Seems on Mac needs to do immediate push following authentication and joining commands gives you that.

jeterpan commented 4 years ago

Mine was a dumb mistake I was using wrong username in the image tag

For example: the incorrect: dtrump the correct for me must be: donaldtrump

dtrump/myrepo donaldtrump/myrepo

So I renamed the image

docker image tag dtrump/myrepo donaldtrump/myrepo

and the push was succeeded

vvajravel commented 4 years ago

I am still getting the same error is there any permanent fix

docker push vinu The push refers to repository [docker.io/library/vinu] c37e1aa8c6c6: Preparing e0b3afb09dc3: Preparing 6c01b5a53aac: Preparing 2c6ac8e5063e: Preparing cc967c529ced: Preparing denied: requested access to the resource is denied

foger commented 4 years ago

Same here. If repository is private I get an error: "denied: requested access to the resource is denied". I tried docker logout and again docker login, restarted terminal and even the machine - all without results. If I set my repo to public - all work's fine

UPD: For me that's because only one private repository accepted on the free repository plan as i see in my profile page on docker hub:

1 OF 1 FREE PRIVATE REPOSITORY IN USE
Purchase plans starting at $7/ month for 5 private repositories
Bhagyashreek8 commented 4 years ago

This worked for me docker login -u "username" -p "password" docker.io && docker push personalhub/reponame:latest https://github.com/docker/hub-feedback/issues/1222#issuecomment-564041216 thank you @pwfilehost

ahsan-khan1999 commented 4 years ago

I am also facing same issue while pushing docker image without tagging with username , i tag image name with my username and it works fine!

misko566 commented 4 years ago

Same problem and nothing in here works for me.

docker login docker.io Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one.

Username: username Password: Login Succeeded

docker push username/reponame:v1 The push refers to repository [docker.io/username/reponame] af8474fce3cd: Preparing 1607f8f4d8a9: Preparing b9fe43e46b7f: Preparing f205bc16cba1: Preparing 9c1401b06d4c: Preparing 8df67d7ddd28: Waiting 552ab5a3fbce: Waiting 2ef5314893da: Waiting 74410bc36ca1: Waiting 750ac500a541: Waiting 2de391e51d73: Waiting d73dd9e65295: Waiting 686245e78935: Waiting d7ff1dc646ba: Waiting 644879075e24: Waiting denied: requested access to the resource is denied

misko566 commented 4 years ago

OK I found something. IF nothing helps check your docker app version. For me it helps just upgrading it to latest version :)

shaunwarman commented 4 years ago

...

docker login --username=<username> --password=<password> && docker push <username>/<image_name>:<tag>

Worked for me as well.

vvajravel commented 4 years ago

still getting the same issue , any permanent fix for this without upgrading , please advice

manjeetsorout commented 4 years ago

@hbirkdale I could now push again simply with the sequence:

docker login
docker push <tag>

And without switching the repo to private. None of this really makes sense, but somehow it unlocked my problem on this one repo.

thanx

namanrawal47 commented 4 years ago

This is an old thread, but I figured out what the problem for me was. I tried switching to root and trying again, and the error I got was that an ssh connection was not allowed. So I checked my ssh keys in my particular user...it seems that my public key contents were not in my "authorized_keys" file under ~/.ssh

I copied and pasted my public key contents into there, reload sshd service using "service sshd reload", and tried the push again and it worked. Keep in mind that I'm using Ansible playbooks to automate docker activities, but it might still be a relevant solution to you if it's a keys issue.

lucas234 commented 4 years ago

I am also facing the same issue while pushing my docker image. I tag the image name with my docker hub username and it works fine! (make sure the username is: docker-hub-username/yourapp) docker tag test/myfirstapp docker-hub-username/myfirstapp:latest

eapostol commented 4 years ago

After trying a few of the examples above and didn't work I did some google search and I was able to get this link: https://ropenscilabs.github.io/r-docker-tutorial/04-Dockerhub.html and did the followings: docker login --username=yourhubusername --email=youremail@company.com

docker images example of output:

REPOSITORY TAG IMAGE ID CREATED SIZE

verse_gapminder_gsl latest 023ab91c6291 3 minutes ago 1.975 GB

verse_gapminder latest bb38976d03cf 13 minutes ago 1.955 GB

rocker/verse latest 0168d115f220 3 days ago 1.954 GB

and then did this: docker tag bb38976d03cf yourhubusername/verse_gapminder:firsttry Lastly docker push yourhubusername/verse_gapminder

But I believe you understand where you need to replace things appropriately.

Could you explain why this works? It worked for me and for that I am grateful, but what is the significance of the :firstry part (if anything)

Michael-Masas commented 4 years ago

After trying a few of the examples above and didn't work I did some google search and I was able to get this link: https://ropenscilabs.github.io/r-docker-tutorial/04-Dockerhub.html and did the followings: docker login --username=yourhubusername --email=youremail@company.com docker images example of output:

REPOSITORY TAG IMAGE ID CREATED SIZE

verse_gapminder_gsl latest 023ab91c6291 3 minutes ago 1.975 GB

verse_gapminder latest bb38976d03cf 13 minutes ago 1.955 GB

rocker/verse latest 0168d115f220 3 days ago 1.954 GB

and then did this: docker tag bb38976d03cf yourhubusername/verse_gapminder:firsttry Lastly docker push yourhubusername/verse_gapminder But I believe you understand where you need to replace things appropriately.

Could you explain why this works? It worked for me and for that I am grateful, but what is the significance of the :firstry part (if anything)

Thank you Very Much Kind Sir. this has worked for after a few login tries.

sivadath commented 4 years ago

logout and login again worked for me.

kajonas commented 4 years ago

OK the problem is solved! username in docker push arnoldnonsotp/match_microservice was wrong.

Yes, When we build the image, the image should be username/reponame, or will be denied

This worked perfectly for me, and makes sense build image with --> your-acct-name/your-image-name push image with --> your-acct-name/your-image-name

diegopereira33 commented 4 years ago

I had the same problem:

The solution was:

docker login --username username

xyshirly commented 4 years ago

I had the same problem and my solution as following: 1.docker login 2.docker tag YOUR_IMAGE_NAME DOCKER_HUB_NAME/YOUR_IMAGE_NAME 3.docker push DOCKER_HUB_NAME/YOUR_IMAGE_NAME

finally, it works for me.

terminal shows "denied: requested access to the resource is denied" if I push the image directly without tag it. image

Freyert commented 4 years ago

SUMMARY TIME

I recommend closing this ticket and pointing people to the following docker-cli issues where they might actually see a fix.

There are a variety of solutions here some are reasonable. Others are not.

  1. Make sure you are logged in and pushing the image correctly.
    • Best example
    • Best example because:
      • Very clear step by step instructions
      • Visual confirmation of correct output
      • Very recent
  2. The session went bad; so login and logout.
  3. For some terrible unknown reason you need to enter the password in plain text on the command line. (This was my case, thanks @svw26)
  4. Your dockerconfig is jacked up. Delete it and start over.
    • Best example
    • Best example because:
      • clear, concise, simple
    • Honestly would not really recommend doing this if you can avoid it.
  5. Flapping your docker repository from private to public fixes things

Personal Docker client info

$ docker version
Client:
 Version:           18.06.1-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        e68fc7a
 Built:             Tue Aug 21 17:21:31 2018
 OS/Arch:           darwin/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.1-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       e68fc7a
  Built:            Tue Aug 21 17:29:02 2018
  OS/Arch:          linux/amd64
  Experimental:     true
kajonas commented 4 years ago

Thanks for the feedback. Keith Jonas LTT Inc. kajonas@yahoo.com

On Wednesday, February 26, 2020, 01:25:24 PM CST, Fulton Byrne <notifications@github.com> wrote:  

SUMMARY TIME

There are a variety of solutions here some are reasonable. Others are not.

Personal Docker client info $ docker version Client: Version: 18.06.1-ce API version: 1.38 Go version: go1.10.3 Git commit: e68fc7a Built: Tue Aug 21 17:21:31 2018 OS/Arch: darwin/amd64 Experimental: false

Server: Engine: Version: 18.06.1-ce API version: 1.38 (minimum version 1.12) Go version: go1.10.3 Git commit: e68fc7a Built: Tue Aug 21 17:29:02 2018 OS/Arch: linux/amd64 Experimental: true

OK now that I'm getting my bearing this is probably not the right place for some of the problems in this issue.

If you had to flap the repo from public to private that is probably a dockerhub problem, but everything else is dockercli.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

vishal9p commented 4 years ago

Only thing you need to do is give proper naming while commiting username/imageName something in this format else you will need to use setting tag

ArieLevs commented 4 years ago

I've had this issue only when using automation scripts pushing to docker hub, The issue started with docker app tokens, and a combination of explicit registry url,

Since i'm using docker login [DOCKER_REGISTRY] --username [USERNAME] and not using the default docker login --username [USERNAME].

So, if you add explicit docker registry make sure to exactly add https://index.docker.io/v1/ and this will work with application token.

snowshoes commented 4 years ago

tried all these solution and none of them worked then tried : docker login -u "username" -p "password" docker.io && docker push personalhub/reponame:latest it worked and only thing changed was lining those two commands. It doesn't make sense and all similar issue below suggest dockerhub need to sort this crap out. I can't get those hours back - ever!

That's the workaround !!! Wasting hours to get this work out, but still can't be satisfied with the solution provided as non official explanation since then. It should be considered as a bug as docker community should fix it. Why close the issue even without offering the official solution ?

upinfo commented 4 years ago

OK the problem is solved! username in docker push arnoldnonsotp/match_microservice was wrong.

Yes, When we build the image, the image should be username/reponame, or will be denied

This worked perfectly for me, and makes sense build image with --> your-acct-name/your-image-name push image with --> your-acct-name/your-image-name

upinfo commented 4 years ago

yes it work well for me as well task:

thanks so much, i had spent a whole day trying to push the image to dockerhub via my playbook, kept getting denied access until I try your method.

vadimslu commented 4 years ago

You would have to put your username under "Collaborators" If you are trying to push image under diff username.

RocketEins commented 4 years ago

I've tried all of the above workarounds. This issue seems widespread with no legit explanations or resolutions. I've continuously had this issue and ultimately resorted to hosting a private registry.

Is this just a legitimate bug? Any light shed would be greatly appreciated :)

Make sure before slash is your docker hub username

linceaerian commented 4 years ago

Got the same problem... I wonder if it's linked to: image

Deleting & pushing again the image work, update don't... it should not work as private as there is an overquota.... a bit strange.

feeblefakie commented 4 years ago

For me, making it public and back to private resolves the issue. (I'm using 5 of 5 private repos) Seems like an authentication issue.

nehalchoraria commented 4 years ago

In my case this happened when I was logged in docker hub from another account but docker login to the new account was not updating for some reason. @wistonk trick worked for me.

we-taper commented 4 years ago

I had the same problem and I realize I need to docker logout before docker login again.

tatacyprian commented 4 years ago

Had similar problem pushing images to dockerhub using ansible playbook. What I did was switch to root and then issue docker login. Then switched to regular user and was able to push images to docker hub successfully.

wintuvogga commented 4 years ago

Save your docker account password in ~/mydockerpassword.txt`

then

cat ~/mydockerpassword.txt | sudo docker login --username wintuvogga --password-stdin

Azsu commented 4 years ago

@hbirkdale I could now push again simply with the sequence:

docker login
docker push <tag>

And without switching the repo to private. None of this really makes sense, but somehow it unlocked my problem on this one repo.

This worked for me, Docker Desktop was logged in but apparently the CLI and App do not share credentials.

lingocoder commented 4 years ago

I just ran into this same thing. What solved it for me was a logout/re-login

…
$ docker logout
Removing login credentials for https://index.docker.io/v1/
$ docker login
Login with your Docker ID to push and pull images from Docker Hub…
Username: lingocoder
Password:
…
Login Succeeded

$ docker push ...
The push refers to repository [docker.io/lingocoder/…
…
6222…f3fd5: Pushed
5e6a…d720b: Pushed
…
b817…beda0: Pushed
44c2…9ef5a: Pushed
heuer: digest: sha256:d342f76cf48716aaa…dd6cda5bee7e1971a9d1aedf62d1c881bd2a013 size: 3777
…