Add self signed Java certificate with Google Jib

1.3k Views Asked by At

I have a Spring Boot Java app and I use Google Jib to create a docker image (I deploy the image locally for now) based on gcr.io/distroless/java:11.

My Java app needs to access a HTTPS resource that has a self-signed certificate. Locally (without docker) I added the certificate to the Java certificates with the following command in order to develop and debug my spring boot app.

"C:\Program Files\Java\jdk-11\bin\keytool" -importcert -file C:\Users\FooBar\Downloads\mycert.pem -alias foobar -keystore "C:\Program Files\Java\jdk-11\lib\security\cacerts" -storepass changeit

I need to somehow add this certificate to the image I create with Jib. However, all the posts online give a solution that either involves a Docker File (I do not have one) or Kubernetes and other cloud technologies I do not use (for instance Docker Swarm).

Can someone please give me some help or provide a solution involving Jib that lets me add this certificate to the certificates of the JVM that run inside the container?

0

There are 0 best solutions below