Docker registry with TLS – using a .pem file

dockerdocker-registry

In this docker guide https://docs.docker.com/registry/deploying/ is the example for using crt and key:

docker run -d -p 5000:5000 –restart=always –name registry \
-v pwd/certs:/certs \
-e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/domain.crt \
-e REGISTRY_HTTP_TLS_KEY=/certs/domain.key \
registry:2

What should I use in case I have a .pem file?

Thanks.

Best Answer

Separate the PEM file into two DER files (one for the private key and one for the certificate):

openssl x509 -in yourperm.pem -outform DER -out yourcert.crt
openssl pkey -in yourpem.pem -out yourkey.key

Also worth noting, the PEM file actually has the key and certificate next to each other in plan text. You can open the file and cut / paste them out to two files as well.