Our Docker images ship closed sources, we need to store them somewhere safe, using own private docker registry. We search the simplest way to deploy a private docker registry with a simple authentication layer.
I found :
- this manual way http://www.activestate.com/blog/2014/01/deploying-your-own-private-docker-registry
- and the
shipyard/docker-private-registry
docker image based on stackbrew/registry and adding basic auth via Nginx - https://github.com/shipyard/docker-private-registry
I think use shipyard/docker-private-registry
, but is there one another best way?
I have create an almost ready to use but certainly ready to function setup for running a docker-registry: https://github.com/kwk/docker-registry-setup .
Maybe it helps.
Everything (Registry, Auth server, and LDAP server) is running in containers which makes parts replacable as soon as you're ready to. The setup is fully configured to make it easy to get started. There're even demo certificates for HTTPs but they should be replaced at some point.
If you don't want LDAP authentication but simple static authentication you can disable it in
auth/config/config.yml
and put in your own combination of usernames and hashed passwords.I'm still learning how to run and use Docker, consider this an idea:
The registry is then accessible at localhost:5000, authentication is done through ssh that you probably already know and use.
Sources:
You can also use an Nginx front-end with a Basic Auth and an SSL certificate.
Regarding the SSL certificate I have tried couple of hours to have a working self-signed certificate but Docker wasn't able to work with the registry. To solve this I have a free signed certificate which work perfectly. (I have used StartSSL but there are others). Also be careful when generating the certificate. If you want to have the registry running at the URL registry.damienroch.com, you must give this URL with the sub-domain otherwise it's not going to work.
You can perform all this setup using Docker and my nginx-proxy image (See the README on Github: https://github.com/zedtux/nginx-proxy). This means that in the case you have installed nginx using the distribution package manager, you will replace it by a containerised nginx.
.crt
and.key
files) on your server in a folder (I'm using/etc/docker/nginx/ssl/
and the certificate names areprivate-registry.crt
andprivate-registry.key
)/etc/docker/nginx/htpasswd/
and the filename isaccounts.htpasswd
)/etc/docker/registry/
)Here is an example of the commands to run for the previous steps:
The first line starts nginx and the second one the registry. It's important to do it in this order.
When both are up and running you should be able to login with: