First of all, I wanted to recommend the following recipe from Digital Ocean on how to rollout your own Docker Registry in Ubuntu 14.04. As with most of their stuff, it is super easy to follow.
I also wanted to share a small improvement on the recipe to include a UI front-end to the registry.
Once you have completed the recipe and have a repository secured and running, you extend your docker-compose file to look like this:
nginx:
image: "nginx:1.9"
ports:
- 443:443
- 8080:8080
links:
- registry:registry
- web:web
volumes:
- ./nginx/:/etc/nginx/conf.d:ro
web:
image: hyper/docker-registry-web
ports:
- 8000:8080
links:
- registry
environment:
REGISTRY_HOST: registry
registry:
image: registry:2
ports:
- 127.0.0.1:5000:5000
environment:
REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY: /data
volumes:
- ./data:/data
You will also need to include a configuration file for web in the nginx folder.
file: ~/docker-registry/nginx/web.conf
upstream docker-registry-web {
server web:8080;
}
server {
listen 8080;
server_name [YOUR DOMAIN];
# SSL
ssl on;
ssl_certificate /etc/nginx/conf.d/domain.crt;
ssl_certificate_key /etc/nginx/conf.d/domain.key;
location / {
# To add basic authentication to v2 use auth_basic setting plus add_header
auth_basic "registry.localhost";
auth_basic_user_file /etc/nginx/conf.d/registry.password;
proxy_pass http://docker-registry-web;
proxy_set_header Host $http_host; # required for docker client's sake
proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 900;
}
}
docker-compose up and you should be able to have a ssl secured UI frontend in port 8080 (https://yourdomain:8080/)
If you have any improvement tips I am all ears!