DockerDocker private/secure registry with API v2


Introduction

A private and secure docker registry instead of a Docker Hub. Basic docker skills are required.

Parameters

CommandExplanation
sudo docker run -p 5000:5000Start a docker container and bind the port 5000 from container to the port 5000 of the physical machine.
--name registryContainer name (use to make “docker ps” readability better).
-v 'pwd'/certs:/certsBind CURRENT_DIR/certs of the physical machine on /certs of the container (like a “shared folder”).
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/server.crtWe specify that the registry should use /certs/server.crt file to start. (env variable)
-e REGISTRY_HTTP_TLS_KEY=/certs/server.keySame for the RSA key (server.key).
-v /root/images:/var/lib/registry/If you want to save all your registry images you should do this on the physical machine. Here we save all images on /root/images on the physical machine. If you do this then you can stop and restart the registry without losing any images.
registry:2We specify that we would like to pull the registry image from docker hub (or locally), and we add « 2 » because we want install the version 2 of registry.

Remarks