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?


  • Use the pem file. – Michael Hampton Dec 16 '15 at 14:05
  • What I meant was, which -e option to specify? -e REGISTRY_HTTP_TLS...? – Eran Dec 16 '15 at 14:27
  • Is it the certificate or the private key? – Michael Hampton Dec 16 '15 at 14:34
  • The PEM file contains both. – Eran Dec 16 '15 at 14:39
  • How did that happen? Those should never be distributed to you in the same file. Have you been compromised? Did you share the private key with someone else? – Michael Hampton Dec 16 '15 at 14:44

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.