Importing self-signed cert into Docker's JRE cacert is not recognized by the service

  • A Java Service is running inside the Docker container, which access the external HTTPS url and its self-sign certificate is unavailable to the service/ JRE cacert keystore and therefore connection fails.
  • Hence imported the self-signed certificate of HTTPS external URL into Docker container’s JRE cacert keystore. (after checking the $JAVA_HOME env. variable)
  • Restarted the Docker container (using “docker restart” command), hoping that the service is also get restarted and pick the changes from JRE cacert. But this didn’t happen, the Java service still fails to access external HTTPS URL.

Any idea how a Java service running inside the Docker container pick the JRE cacert changes with new certificate import?

  • How can I make docker-machine create a VM in a specific location
  • Nginx as Reverse Proxy for Docker VHosts
  • Symlink to volume in Docker container
  • Copy folder with wildcard from docker container to host
  • How to watch docker event with engine-api
  • How do I setup a docker image to dynamically pull app code from a repository?
  • What is the recommended setup for an Elasticsearch cluster that contains data at the scale of TBs and above? [closed]
  • vagrant: Run shell script in Virtualbox after Docker instances boot (ordering is wrong)
  • How to properly set up dockerized django app with SSL handling using self-signed certificate and mod_wsgi-express?
  • AWS: docker container cannot connect to external website on SSL
  • Cannot remove all containers in a row
  • RESTful API 2x nodejs apps on same server, with fallback
  • One Solution collect form web for “Importing self-signed cert into Docker's JRE cacert is not recognized by the service”

    Hence imported the self-signed certificate of HTTPS external URL into Docker container’s JRE cacert keystore.

    No: you need to import it into the Docker image from which you run your container.

    Importing it into the container would only create a temporary writable data layer, which will be discarded when you restart your container.

    Something like this answer:

    USER root
    COPY ldap.cer $JAVA_HOME/jre/lib/security
    RUN \
        cd $JAVA_HOME/jre/lib/security \
        && keytool -keystore cacerts -storepass changeit -noprompt -trustcacerts -importcert -alias ldapcert -file ldap.cer
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.