on normal docker hosts that want to use this private registry: CentOS7:
vi /etc/sysconfig/docker
INSECURE_REGISTRY='--insecure-registry=docker-registry-host:5000'
2. Configure access through Nginx to your private docker registry
vi /etc/hosts
ip-address-of-docker-registry www.ilovedocker.com
mkdir /etc/nginx/sites-available
vi /etc/nginx/sites-available/docker-registry
# For versions of Nginx > 1.3.9 that include chunked transfer encoding support
# Replace with appropriate values where necessary
upstream private-docker-registry {
server localhost:5000;
}
server {
listen 443;
server_name www.ilovedocker.com;
vi /etc/sysconfig/docker-registry
REGISTRY_ADDRESS=127.0.0.1
systemctl restart docker-registry
yum -y install httpd-tools
htpasswd -c /etc/nginx/docker-registry.htpasswd USERNAME
Open the file /etc/nginx/nginx.conf and add after the line “include /etc/nginx/conf.d/*.conf;”the following:
include /etc/nginx/sites-enabled/*;
3. Configure Nginx to use ssl
mkdir ~/certs
cd ~/certs
create a new root key:
openssl genrsa -out dockerCA.key 2048
create a root certificate, you don’t have to answer the upcoming question, just hit enter:
openssl req -x509 -new -nodes -key dockerCA.key -days 3650 -out dockerCA.crt
create a private key for your Nginx Server:
openssl genrsa -out www.ilovedocker.com.key 2048
Next a certificate signing request is needed:
openssl req -new -key www.ilovedocker.com.key -out www.ilovedocker.com.csr
Answer the upcoming question for “Common Name” with the domain of your server, e.g: www.ilovedocker.com. Don’t provide a challenge password.