Skip to content

Latest commit

 

History

History
81 lines (42 loc) · 2.98 KB

docker_certificate_guide.md

File metadata and controls

81 lines (42 loc) · 2.98 KB

How to include certificate into docker

Prerequisites

  1. You have certificates for all your core systems. If not, follow the Certificate guide first.

Steps

  1. Check you have all the necessary certificates
  2. Edit your property file
  3. Overwrite the Secure Mode properties
  4. Edit your docker-compose.yml
  5. Mount the certificates as a volume to the containers

Please make sure, you have already generated the certificates you wish to use.

Step 1

Open the Core Systems application.properties file with your favorite editor.

Step 2

Scroll down to the Secure Mode part of the properties file and edit:

  • server.ssl-key-store property

By default its value is: classpath:certificates/service_registry.p12, it means it will search for the certificate inside the JAR file, we have to change it to file:<your_certificate_name.extension (ex.: file:service_registry.p12). This means, when the application starts up, it will load the certificate from the same folder as the JAR.

  • server.ssl.key-store-type property

If your file is not a p12 file, change it accordingly

  • server.ssl.key-store-password property

You should really not use the default password. Hopefully you used a different password when generating the certificate.

Step 3

Repeat Step 2 and Step 3 for every property file

Open the docker-compose.yml file with your favorite editor.

Step 4

Mount the certificate file as a volume inside the container.

The syntax is: - outside_path/outside_certificate.name:inside_path/inside_certificate.name

Step 5

In the image you can see two examples. I'll explain the first one.

- ./tmit_certs/service_registry.p12:/serviceregistry/service_registry.p12

In Step 1 we saw that our certificates were inside a folder called tmit_certs. We are mounting the service_registry.p12 file from the tmit_certs folder on the host machine inside the Docker Container into the serviceregistry folder under the name of service_registry.p12

Note: The certificate name you specified in Step 3 MUST match the inside_certificate.name specified in Step 5, otherwise it won't work.

Congratulations, you are all set! You can start your containers :)