I'm trying to add a certificate into $JAVA_HOME/jre/lib/security/cacerts
truststore on my Dockerfile
:
FROM frolvlad/alpine-oraclejdk8:slim
VOLUME /tmp
RUN keytool -import -alias vault -storepass changeit -keystore $JAVA_HOME/jre/lib/security/cacerts -noprompt -trustcacerts -file /var/run/secrets/kubernetes.io/certs/tls.crt
ADD wseccloudconfig-0.0.1-SNAPSHOT.jar app.jar
RUN sh -c 'touch /app.jar'
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ]
As you can see I'm performing a command keytool...
in order to insert the certificate to cacerts
.
I'm deploying this image into my openshift/kubernetes cluster. Once I've connected to pod shell, I'm able to run this keytool...
command rightly. So I mean, the command is well formed. There're no syntax problem or related issues...
So, I was excepting that the output of this command: keytool -list -keystore $JAVA_HOME/jre/lib/security/cacerts
appears my certificate, but it doesn't appear.
Any ideas?
EDIT
Also I've tried writing this in Dockerfile
:
CMD ["keytool", "-import", "-alias", "vault", "-storepass", "changeit", "-keystore", "$JAVA_HOME/jre/lib/security/cacerts", "-noprompt", "-trustcacerts", "-file", "/var/run/secrets/kubernetes.io/certs/tls.crt"]