1

I have an existing WordPress website running inside a docker container on a Azure hosted Linux VM. I have followed the instruction at Why does 'az vm secret format' command fail when prepping SSL cert of Linux VM deployment? so that the SSL certificate has been associated with the VM, and port 443 is also open on the VM.

How do I now associate the SSL cert to the WordPress application running in the Docker containiner hosted on this Linux VM?

Charles Xu
  • 29,862
  • 2
  • 22
  • 39
ProfNimrod
  • 4,142
  • 2
  • 35
  • 54

1 Answers1

0

When you create the Linux VM with the certificate, then certificates and keys are stored in the protected /var/lib/waagent/ directory. It shows in the document SSL Certificates Add to Linux VM. You can find the certificate and mount it to your container like this:

docker run -v /var/lib/waagent/yourcert:/container/to/path/cert -d --name containerName yourImage

Then you can use the certificate in your container for your application as you wish.

EDIT

The certificate in the directory will show like this:

enter image description here

Not the name that you create in the Key Vault.

Charles Xu
  • 29,862
  • 2
  • 22
  • 39
  • Looks like we're on the right track here. I can see the *crt and *.prv files for my cert in /var/lib/waagent as you indicate. What do you mean by /container/to/path/cert ? Where would this typically be? Or is this simply my choice. Is containerName the container id obtained when 'docker ps' is run? Sorry for the very basic questions. I'm a total newb when it comes to Linux. – ProfNimrod Jan 29 '19 at 05:40
  • The path /container/to/path/cert means you can the path as you want, it's all dependent you. And I mean you can mount the cert to the container when you create it. – Charles Xu Jan 29 '19 at 06:02
  • @ProfNimrod Any more question? Or if it's helpful you can accept it as the answer. – Charles Xu Feb 01 '19 at 01:51