Handshake Exception in Liberty Profile with Docker

I have an application which calls a external service. This is secured connection.I need to have certificate of the external service in my JDK/jks. When I use keytool command to include the certificate and build my docker image Liberty not able to take the Cert.It always referering key.jks.

I am using Liberty 16.0.03

Dockerfile

FROM websphere-liberty:webProfile7

COPY server.xml /config/
COPY jvm.options /config/

ADD application.war /config/dropins/
ADD mycertificate.cer /resources/security/

ARG REPOSITORIES_PROPERTIES=""

RUN if [ ! -z $REPOSITORIES_PROPERTIES ]; then echo $REPOSITORIES_PROPERTIES > /opt/ibm/wlp/etc/repositories.properties; fi \&& installUtility install --acceptLicense appSecurityClient-1.0 javaee-7.0 javaeeClient-7.0 \&& if [ ! -z $REPOSITORIES_PROPERTIES ] ; then rm /opt/ibm/wlp/etc/repositories.properties; fi \&& rm -rf /output/workarea /output/logs

ENV JAVA_CACERTS ${JAVA_HOME}/lib/security/cacerts
RUN keytool -noprompt -storepass adminpwd -import -trustcacerts -alias myapp -file /resources/security/mycertificate.cer -keystore /resources/security/key.jks

Exception:
[err] javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: PKIXCertPathBuilderImpl could not build a valid CertPath.
[err]   at com.ibm.jsse2.j.a(j.java:12)
[err]   at com.ibm.jsse2.as.a(as.java:118)
[err]   at com.ibm.jsse2.C.a(C.java:193)

  • How can I ssh into “Web App On Linux” docker container on Azure?
  • Docker installation for running node and react environment
  • How to run script file(.sh file) inside Dockerfile? [closed]
  • PULL Docker container/image
  • What are the best practices to manage and move Docker containers?
  • docker-compose: accessing postgres' shell (psql)
  • Cannot link to a running container started by docker-compose
  • Error when running SparkApp from docker container against Spark running in another container
  • Docker : oci runtime error: exec: “/bin/bash”: stat /bin in windows 7
  • Docker - how to setup connection to container to localhost
  • docker postgres pgadmin local connection
  • Haproxy and intermittent 503 issues
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.