Docker Community Forums

Share and learn in the Docker community.

'unauthorized: authentication required' when trying to do a `docker push` with DTR


(Drewkhoury) #1

I’m evaluating DTR and have followed the automatic installation.

What I’ve done

I’ve set the domain name (using the private IP I’m using … not sure if this is allowed or if I need a ‘real’ domain?).

I’ve applied the CS Docker licence, created two users (admin and drew who is not admin), generated SSL Certs as per and created a repo via the UI (drew/foo)

What I’m trying to do, a push

I’m able to login to DTR via the command line (following instructions here

[vagrant@docker1 ~]$ sudo docker login
Username (drew):
WARNING: login credentials saved in /root/.docker/config.json
Login Succeeded

Then I try to do a push but recieve the error ‘unauthorized: authentication required’.

[vagrant@docker1 ~]$ sudo docker push
The push refers to a repository []
9523b66f5278: Preparing
unauthorized: authentication required

I’ve tried pulling existing images, and even creating my own. All have the same result. Here is an example of my own image.

[vagrant@docker1 ~]$ touch hello
[vagrant@docker1 ~]$ cat Dockerfile
FROM scratch
COPY hello /
CMD ["/hello"]
[vagrant@docker1 ~]$ sudo docker build -t .
Sending build context to Docker daemon 178.2 kB
Step 1 : FROM scratch
Step 2 : COPY hello /
---> Using cache
---> 061442e33417
Step 3 : CMD /hello
---> Using cache
---> 2527d9132ebc
Successfully built 2527d9132ebc

After reading the other posts (and making sure I’m not using an admin account, that the repo exists, that I’m using sudo for the push commands) I’m not sure why I’m getting the authentication message.

Are the specific logs or debug that I could use, or something different I need to try to get it to work?

(Michael Vilain) #2

I’m having this problem as well. Previous incidents of this error on Goggle point to the authentication failure on Docker Hub. There’s no posting about this being a current problem, so I’m trying to figure out why the documented build procedure that used to work now fails.

(Drewkhoury) #3

I’ve found two distinct cases where I receive the unauthorized: authentication required:

1. Docker can’t find the repo for my given image

I haven’t created the correct repository name to hold the image (this was due to my understanding that repos have a direct 1-1 relationship with images, they do NOT hold many differently named images).

So when I tried to push the image-tag to the repo drew/foo docker was actively refusing to do so (by design).

What I meant to do was push the image-tag to the repo drew/foo.

#2. Docker doesn’t like my hostname

I tried another example with the hostname docker1 configured in Vagrant/Virtualbox inside the guest /etc/hosts file … docker gives the same error message … so be careful what domain you use, your milage may vary.

Docker Push Error : FATA[0001] Respository does not exist
(Rojadub) #4

Signed up just to thank you…was struggling for hours over this before seeing your statement about 1-1 relationship between repos and images

Thats when it dawned on me that docker uses repo and image names synonymously…aargh !