我计划使用Java 11而不是Java 8。当我使用Java 11作为基础映像时,我遇到了这个错误。但是,如果我使用jdk8基础映像,Dockerfile运行良好。以下是我的Dockerfile:
FROM docker.repo1.aaa.com/ecap/base-images/centos-8-openjdk11:latest
EXPOSE 8080
WORKDIR .
COPY bbb-service/target/*.jar bbb-service.jar
COPY aaa-engine/target/*.jar aaa-engine.jar
COPY certs/* /tmp/cacerts/
COPY aaa-service-chart aaa-service-chart
# Cert Creation
RUN ${JAVA_HOME}/bin/keytool -noprompt -keystore ${JAVA_HOME}/jre/lib/security/cacerts -storepass changeit -importcert -alias aaa-ca-full -file /tmp/cacerts/aaa_ca1_full_chain.pem
CMD ["java", "-jar", "aaa-engine.jar"]
Jenkins构建日志:
---> Running in 851cd67765d4
[91mCertificate was added to keystore
[0mkeytool error: java.io.FileNotFoundException: /jre/lib/security/cacerts (No such file or directory)
The command '/bin/sh -c ${JAVA_HOME}/bin/keytool -noprompt -keystore ${JAVA_HOME}/jre/lib/security/cacerts -storepass changeit -importcert -alias aaa-ca-full -file /tmp/cacerts/aaa_ca1_full_chain.pem' returned a non-zero code: 1
[Pipeline] echo
如何解决此问题?
1条答案
按热度按时间hsvhsicv1#
如果你使用的是JDK11+,下面的路径应该是正确的。至少这是我在本地安装中的证书所在的位置。