# Docker Push error - unauthorized: authentication required

**URL:** <https://forums.docker.com/t/docker-push-error-unauthorized-authentication-required/68129>\
**Category:** Docker Hub\
**Created:** [January 30, 2019, 7:04pm UTC](https://forums.docker.com/t/docker-push-error-unauthorized-authentication-required/68129 "2019-01-30T19:04:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kmillett](https://avatars.discourse-cdn.com/v4/letter/k/85f322/32.png) [@kmillett](https://forums.docker.com/u/kmillett)\
**Post date:** [January 30, 2019, 7:04pm UTC](https://forums.docker.com/t/docker-push-error-unauthorized-authentication-required/68129/1 "2019-01-30T19:04:20Z")

</div>

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/](https://index.docker.io/v1/). Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![avinashdesireddy](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@avinashdesireddy](https://forums.docker.com/u/avinashdesireddy)\
**Post date:** [January 30, 2019, 7:51pm UTC](https://forums.docker.com/t/docker-push-error-unauthorized-authentication-required/68129/2 "2019-01-30T19:51:55Z")

</div>

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

```auto
$ 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

```auto
$ docker tag python avinashdesireddy/python

```

The tagged image will appear as follows

```auto
$ 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

```auto
$ 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$

```

---

<div class="post-metadata">

**Author:** ![molecman](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@molecman](https://forums.docker.com/u/molecman)\
**Post date:** [March 5, 2020, 10:02pm UTC](https://forums.docker.com/t/docker-push-error-unauthorized-authentication-required/68129/3 "2020-03-05T22:02:41Z")

</div>

I had the same problem. I had been successful in creating the private repository previously and pushing an image to it. After a month I tried again multiple times with the same result: unauthorized:authentication required. It was really frustrating as it would only give that error after appearing to have successfully pushed the 3GB image to the repo. I had made sure I was properly logged in to Docker using docker login (after logging out and restarting docker desktop).

It was an easy fix even though it took me 3 hours to find it. I had two accounts on my docker login, one for personal and one for work. I was pushing the image to the wrong account. I needed to set it on the docker icon on the system tray to the business repo as it defaulted to my personal repo in the same account.

---

<div class="post-metadata">

**Author:** ![silaspalmer](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/silaspalmer/32/34295_2.png) [@silaspalmer](https://forums.docker.com/u/silaspalmer)\
**Post date:** [April 28, 2022, 7:08am UTC](https://forums.docker.com/t/docker-push-error-unauthorized-authentication-required/68129/4 "2022-04-28T07:08:54Z")

</div>

I had some issues pushing a large-ish image on a slow internet connection - docker’s authentication would time out before the push had finished. I’m trying this as a workaround.

```auto
docker push username/repo:tag &
## that sets it running as a background command, then
while sleep 5; do docker login -u username -p password; done

```

Sadly though, that didn’t work ☹
