Docker Community Forums

Share and learn in the Docker community.

Securing a private docker registry with htpassword


(Amit Likhyani) #1

I’ve deployed a private docker registry and got the TLS certs configured including the intermediate certs. The last step I have is some kind of secure auth to it. I’m looking at https://docs.docker.com/registry/deploying/ and the section on Native Basic Auth. This command simply does not work on my AWS Linux ec2 instance:

docker run --entrypoint htpasswd registry:2 -Bbn testuser testpassword > auth/htpasswd

This is the error I get:

exec: “htpasswd”: executable file not found in $PATH
time=“2015-08-25T22:30:57Z” level=“fatal” msg=“Error response from daemon: Cannot start container 9ad003019c502c8ef9a25960ff31747884814b1a7e8482944d49d3cfb58a1277: [8] System error: exec: “htpasswd”: executable file not found in $PATH”

I’ve tried specifying /usr/bin/htpasswd and removed some of the flags. It doesn’t seem to like -B but to no avail.

Any ideas out there?


(Jeff Anderson) #2

Hello,

I tried running the command from the docs, and it worked for me just fine. The image id that I got when I pulled regstry:2 is: 2f1ef7702586. Is it possible you have an older version of the registry:2 image?

/Jeff


(Amit Likhyani) #3

Which version of Unix are you using? Could Amazon’s Unix be different from Ubuntu for that entry point command?

I really appreciate you responding. One more question: is there a web interface to see the contents of the registry?

Amit Likhyani
(512) 636-6606
Sent from my iPhone


(Jeff Anderson) #4

I just fired up a new, clean docker host using docker-machine and issued the docker run command that you mentioned. That caused me to download the latest version of registry:2. You can inspect the id of your image by typing docker images, and look for the registry repository with the 2 tag.


(Alcachi) #5

I just found the same problem.

As Jeff suggested it seems to be due to the version of the registry image. Unfortunatelly just running a docker pull registry:2 and trying the command again did not solve the issue for me.

I had to first remove the previous image and the traces from previous containers running the registry (docker rm and docker rmi respectively) and after that retrying the command just worked fine: it dowloaded the new registry’s image and created the htpasswd file.