A Docker Registry is a service which you can push Docker images to for storage and sharing. We can deploy our own private Docker Registry behind our firewall with SSL encryption and HTTP authentication. Here we can use centos 7 to install docker registry and using Apache for secure connection with htpasswd.

Docker Private Registry Installation

There are many ways available to install Docker Private Registry on CentOS 7.

Install Docker Private Registry Container

The easiest way to install docker private registry using the container.

# Allow ping and users to run unauthenticated.
<Location /v1/_ping>
Satisfy any
Allow from all
</Location>
# Allow ping and users to run unauthenticated.
<Location /_ping>
Satisfy any
Allow from all
</Location>

Change the valid SSL certificate paths

SSLCertificateFileSSLCertificateKeyFile
Now you try to restart httpd service.

# service httpd restart

Browse your registry with SSL and make sure it works.

https://192.168.1.88/
Now you can login to private registry server

docker login https://192.168.1.88/

provide your username and password, the same you provided when creating the htpasswd file.

-Push your images to docker registry

#docker push 192.168.1.88/centos

Docker registry itself authentication setup

New private docker repository moved as docker distribution. Once you installed docker registry.

Create htpasswd in any file, example /etc/nginx/.htpasswd

example,

# htpasswd -c /etc/nginx/.htpasswd admin

Once done, modify the following docker distribution configuration config