To run the private registry (securely) you have to generate a self-signed certificate, you can refer to previous example to generate it.
For my example I put server.key and server.crt into /root/certs
Before run docker command you should be placed (use
cd) into the directory that contains certs folder. If you're not and you try to run the command you'll receive an error like
level=fatal msg="open /certs/server.crt: no such file or directory"
When you are (
cd /root in my example), you can basically start the secure/private registry using :
sudo docker run -p 5000:5000 --restart=always --name registry -v `pwd`/certs:/certs -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/server.crt -e REGISTRY_HTTP_TLS_KEY=/certs/server.key -v /root/Documents:/var/lib/registry/ registry:2
Explanations about the command is available on Parameters part.