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)

  • Setting Docker container hostname on Elastic Beanstalk
  • Adding services in different consul clients running on same host
  • Docker volume command line option mistaking files for directories
  • Can a docker image use executable from the host?
  • PHP version is wrong in phpinfo() output
  • Service docker start not work(daemon), ubuntu-15.10, To run dockerfile with intelliJ
  • Elastic beanstalk : load balancer DNS unreachable
  • Using docker and hosts file
  • Docker - How to update images
  • Docker on Windows randomly crashes with 0xc0370106 when DockerFile has too many commands
  • How to use alsa sound and/or snd_pcm_open in docker?
  • How to manage command line arguments in docker run command?
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.