(forked from https://github.com/opendns/nginx-auth-proxy for nginx env, but totally changed for this)
Try to run nginx docker container in front of registry container
Mostly it follows the blog Building private Docker registry with basic authentication
nginx
's configuration comes from https://github.com/docker/docker-registry/tree/master/contrib/nginx
!!! All the certifications inside are generated for demo purpose inside. !!!
It works successfully under boot2docker windows environment.
You need to append dokk.co
(testing domain name) in /etc/hosts
's localhost
127.0.0.1 boot2docker localhost localhost.local dokk.co
Download and add ca.pem into your ca trust list.
$ sudo cat ca.pem >> /etc/ssl/certs/ca-certificates.crt
$ sudo /etc/init.d/docker restart
Then you can start two docker containers to try
docker run -d --name registry -p 5000:5000 registry
docker run -d --hostname dokk.co --name nginx --link registry:registry -p 443:443 larrycai/nginx-auth-proxy
open browser to access https://192.168.59.103 , it shall show the nginx https works fine.
Now verify the https basic auth is ok
curl -i -k https://larrycai:[email protected]
Then we see docker push
is ok
docker login -u larrycai -p passwd -e "[email protected]" dokk.co
docker tag ubuntu dock.co/ubuntu
docker push dock.co/ubuntu