有一些困难的时间来更新sonarqube从版本9.8到9.9.1,cacc位于正确的位置为两个版本,但由于某种原因,它说在构建期间**(没有这样的文件或目录)**当构建版本9.9.1。
Docker 9.8版本文件
FROM sonarqube:9.8-developer
SHELL ["/bin/bash", "-c"]
COPY ./cert/* /tmp/
# Import certs
RUN keytool -import -v -trustcacerts -alias my_ca -file /tmp/rootCert.pem \
-keystore /usr/lib/jvm/java-17-openjdk/jre/lib/security/cacerts -noprompt -storepass changeit
RUN keytool -import -v -trustcacerts -alias my_ca_intermediate -file /tmp/rootca-intermediate.pem \
-keystore /usr/lib/jvm/java-17-openjdk/jre/lib/security/cacerts -noprompt -storepass changeit
COPY ./sonar.properties /opt/sonarqube/conf/
字符串
成功构建,如下面的日志所示
$ docker build -t sonar98-troubleshooting:9.8-developer-troubleshooting --no-cache .
[+] Building 6.4s (10/10) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 561B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/sonarqube:9.8-developer 2.3s
=> CACHED [1/5] FROM docker.io/library/sonarqube:9.8-developer@sha256:a73ecba149df1ebb84f0dc483657ab6cdcf8ed5c6cb72964630fb12b043ccc9c 0.0s
=> [internal] load build context 0.0s
=> => transferring context: 147B 0.0s
=> [2/5] COPY ./cert/* /tmp/ 0.1s
=> [3/5] RUN keytool -import -v -trustcacerts -alias my_ca -file /tmp/rootCert.pem -keystore /usr/lib/jvm/java-17-openjdk/jre/lib/security/cacerts -noprompt -storepass changeit 1.9s
=> [4/5] RUN keytool -import -v -trustcacerts -alias my_ca_intermediate -file /tmp/rootca-intermediate.pem -keystore /usr/lib/jvm/java-17-openjdk/jre/lib/security/cacerts -noprompt -storepass changei 1.6s
=> [5/5] COPY ./sonar.properties /opt/sonarqube/conf/ 0.1s
=> exporting to image 0.2s
=> => exporting layers 0.1s
=> => writing image sha256:7abe6db583cd18026362198924549c806c1ce36def7b46796c6e8f613c97bb1f 0.0s
=> => naming to docker.io/library/sonar98-troubleshooting:9.8-developer-troubleshooting
型
Docker 9.9.1版本文件
FROM sonarqube:9.9.1-developer
SHELL ["/bin/bash", "-c"]
COPY ./cert/* /tmp/
# Import certs
RUN keytool -import -v -trustcacerts -alias my_ca -file /tmp/rootCert.pem \
-keystore /usr/lib/jvm/java-17-openjdk/jre/lib/security/cacerts -noprompt -storepass changeit
RUN keytool -import -v -trustcacerts -alias my_ca_intermediate -file /tmp/rootca-intermediate.pem \
-keystore /usr/lib/jvm/java-17-openjdk/jre/lib/security/cacerts -noprompt -storepass changeit
COPY ./sonar.properties /opt/sonarqube/conf/
型
即使 "/usr/lib/jvm/java-17-openjdk/jre/lib/security/caclets” 是一个有效的位置/文件,在构建过程中也会显示错误。如下面的日志所示
$ docker build -t sonar991-troubleshooting:9.9.1-developer-troubleshooting --no-cache .
[+] Building 3.1s (7/9)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 563B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/sonarqube:9.9.1-developer 1.0s
=> [internal] load build context 0.0s
=> => transferring context: 147B 0.0s
=> CACHED [1/5] FROM docker.io/library/sonarqube:9.9.1-developer@sha256:d231773f02bf99229353792408e96ad75c537d0f93ce66f67dcd61dc9e2e40d9 0.0s
=> [2/5] COPY ./cert/* /tmp/ 0.1s
=> ERROR [3/5] RUN keytool -import -v -trustcacerts -alias my_ca -file /tmp/rootCert.pem -keystore /usr/lib/jvm/java-17-openjdk/jre/lib/security/cacerts -noprompt -storepass changeit 1.8s
------
> [3/5] RUN keytool -import -v -trustcacerts -alias my_ca -file /tmp/rootCert.pem -keystore /usr/lib/jvm/java-17-openjdk/jre/lib/security/cacerts -noprompt -storepass changeit:
#7 1.451 Certificate was added to keystore
#7 1.451 [Storing /usr/lib/jvm/java-17-openjdk/jre/lib/security/cacerts]
#7 1.777 keytool error: java.io.FileNotFoundException: /usr/lib/jvm/java-17-openjdk/jre/lib/security/cacerts (No such file or directory)
#7 1.778 java.io.FileNotFoundException: /usr/lib/jvm/java-17-openjdk/jre/lib/security/cacerts (No such file or directory)
#7 1.781 at java.base/java.io.FileOutputStream.open0(Native Method)
#7 1.781 at java.base/java.io.FileOutputStream.open(Unknown Source)
#7 1.782 at java.base/java.io.FileOutputStream.<init>(Unknown Source)
#7 1.783 at java.base/java.io.FileOutputStream.<init>(Unknown Source)
#7 1.783 at java.base/sun.security.tools.keytool.Main.doCommands(Unknown Source)
#7 1.783 at java.base/sun.security.tools.keytool.Main.run(Unknown Source)
#7 1.783 at java.base/sun.security.tools.keytool.Main.main(Unknown Source)
型
1条答案
按热度按时间zpqajqem1#
首先,您应该为JAVA_HOME使用环境变量。
我在使用密钥库时遇到了另一个问题。我的问题是我没有权限向密钥库文件添加证书。
字符串