How do i create a tls secured localhost docker registry?
-
Also see: How do i create a localhost docker registry and push an image to it?
Create the self-signed certificate.
$ mkdir certs $ cd certs $ openssl req -newkey rsa:4096 -nodes -sha256 -keyout dockerfish.key -x509 -days 365 -out dockerfish.crt
Create the registry using the self-signed certificate.
$ docker run -d --restart=always --name registry -v `pwd`:/certs \ -e REGISTRY_HTTP_ADDR=0.0.0.0:5000 \ -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/dockerfish.crt \ -e REGISTRY_HTTP_TLS_KEY=/certs/dockerfish.key \ -p 5000:5000 \ registry:2
See the related article at the top, to push an image to the registry.
© Lightnetics 2024