I have been unable to do a “docker push” for the past 2 days. When I issue the push command it appears to upload the image until the very end of the process when I get the “unauthorized: authentication required” error. I can pull an image, just not push one. I have logged out and logged back in with no change. The url in my config.json is https://index.docker.io/v1/. Any help would be appreciated.
The image has to be tagged appropriately to push. Looks like the images is being pushed to a different repository instead of the repository owned by you.
Here is an example, I am using python image from docker hub:
This command fails because you are not authorized to push the image to the default repository
$ docker push python The push refers to repository [docker.io/library/python] 29778035860f: Layer already exists fc88d2431f4d: Layer already exists 1dc1b82fa010: Layer already exists 09e3fd9cf357: Layer already exists 138d1921c15b: Layer already exists d714f65bc280: Layer already exists fd6060e25706: Layer already exists d7ed640784f1: Layer already exists 1618a71a1198: Layer already exists errors: denied: requested access to the resource is denied unauthorized: authentication required
In order for this to be successful, the image has to be tagged with the username
$ docker tag python avinashdesireddy/python
The tagged image will appear as follows
$ docker images REPOSITORY TAG IMAGE ID CREATED SIZE davinashreddy/docker-tutorial latest f4dc35a9b867 25 hours ago 943MB avinashdesireddy/python latest 2fbd95050b66 4 days ago 927MB python latest 2fbd95050b66 4 days ago 927MB
Now the new image owned by the user can be pushed
$ docker push avinashdesireddy/python The push refers to repository [docker.io/avinashdesireddy/python] d44ff7a4fe91: Mounted from library/python f0471e0a730a: Mounted from library/python 9b544a6417e1: Mounted from library/python 21c09f8186d9: Mounted from library/python 56a89222b908: Mounted from library/python a89464ad2a8f: Mounted from library/python 76dfa41f0a1d: Mounted from library/python c240c542ed55: Mounted from library/python badfbcebf7f8: Mounted from library/python latest: digest: sha256:56a77760cd79f566cec67c188762bf26d10f444767b5ef27744711b08553a653 size: 2218 AD-MBPt13-2018:dotfiles avinashdesireddy$