A private and secure docker registry instead of a Docker Hub. Basic docker skills are required.
Command | Explanation |
---|---|
sudo docker run -p 5000:5000 | Start a docker container and bind the port 5000 from container to the port 5000 of the physical machine. |
--name registry | Container name (use to make “docker ps” readability better). |
-v 'pwd'/certs:/certs | Bind CURRENT_DIR/certs of the physical machine on /certs of the container (like a “shared folder”). |
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/server.crt | We specify that the registry should use /certs/server.crt file to start. (env variable) |
-e REGISTRY_HTTP_TLS_KEY=/certs/server.key | Same 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:2 | We 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. |