Realm "Registry Realm" failed with status: 401 Unauthorized

Hello, I got the problem with private registry Basic Auth, I followed the settings on official docker site:

but always I am getting this error message and not able to docker login to the private registry

FATA[0006] Error response from daemon: no successful auth challenge for “myregistrydomain”:“port”/v2/- errors: [basic auth attempt to “myregistrydomain”:“port”/v2/ realm “Registry Realm” failed with status: 401 Unauthorized]

but when I tried to push the image there it was pushed without problem without login and I could find the image there with Curl.
I am using Debian Jessie and docker version 1.6 I tried even with docker 1.8 and same on Suse 12 but still the same error.
Could someone advise please what could be the problem ?

now it works… I just recreated htpasswd file and added 1 option to docker run registry…

I am facing the same issue now. But couldn’t figure out “added 1 option to docker run registry” in your answer. Kindly elaborate.

Possible solution

I had this problem too. What did work for me was the following.

I thought I have to htpasswd -c htpasswd username.

But what I really had to do is: docker run --rm --entrypoint htpasswd registry:2 -Bbn someusername somepassword >> /opt/docker-registry/auth/htpasswd

Wheres /opt/docker-registry/auth/htpasswd is the file on your host (not in the container).

This /opt/docker-registry/auth/htpasswd then needs to be added to the container with

using docker-compose:
volumes:¬ - /opt/docker-registry/auth:/auth¬

user docker
-v /opt/docker-registry/auth:/auth

hope this helps someone in the future :wink:

1 Like