服务无法识别将自签名证书导入Docker的JRE cacert [英] Importing self-signed cert into Docker's JRE cacert is not recognized by the service

查看:255
本文介绍了服务无法识别将自签名证书导入Docker的JRE cacert的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  • Java服务正在Docker容器中运行,该容器访问外部HTTPS URL并且其自签名证书对于服务/ JRE cacert密钥库不可用,因此连接失败。

  • 因此,将HTTPS外部URL的自签名证书导入Docker容器的JRE cacert密钥库。 (在检查$ JAVA_HOME env。变量之后)

  • 重新启动Docker容器(使用docker restart命令),希望服务也重新启动并从JRE cacert中选择更改。但是这没有发生,Java服务仍然无法访问外部HTTPS URL。

任何想法Java服务如何在其中运行Docker容器用新证书导入选择JRE cacert更改?

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

推荐答案


因此,将HTTPS外部URL的自签名证书导入Docker容器的JRE cacert密钥库。

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

否:您需要将其导入到运行容器的Docker 映像中。

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.

这个答案

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的JRE cacert的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆