OK, so one click might be an exaggeration, but the goal of this project is to create a ridiculously easy setup script for a private docker registry server with authentication through NGINX using SSL.
The script will setup two containers:
- docker-registry v0.9.0
Configured for local storage and persisted by using a volume. - NGINX
Configured with SSL certs and linked to the docker-registry container
Dependencies: You'll need Git and Docker already installed on your server.
Need a server? I recommend Digital Ocean.
##Server Install Instructions
The one liner:
git clone https://github.com/flysonic10/one-click-docker-registry.git && cd one-click-docker-registry && ./build.sh
##Client Install Instructions
Because the server will be using a self-signed certificate, you'll need to set this certificate as 'trusted' on any client machine you will use to access the registry. First, you'll need to retrieve the certificate that your server created, then copy it to the trusted certificates of the client machine.
####Retrieve Certificate
- On your server:
cat one-click-docker-registry/nginx/certs/registryrootCA.crt
- Copy all the output including the BEGIN CERTIFICATE and END CERTIFICATE lines
####OSX through Boot2Docker
- SSH into your boot2docker virtual machine:
boot2docker ssh
- Append certificate to ca-certificates.crt:
sudo vi /etc/ssl/certs/ca-certificates.crt
G
a
ENTER
ctrl-v
:x
ENTER
- Restart Docker:
sudo /etc/init.d/docker restart
- Exit the VM:
exit
####Linux
mkdir /usr/local/share/ca-certificates/registry-root-cert
cp registryrootCA.crt /usr/local/share/ca-certificates/registry-root-cert
update-ca-certificates
##Usage
-
docker login https://your-server-url.com
-
docker tag whaever-image your-server-url.com/whatever-image
-
docker push your-server-url.com/test-image
That's all folks.