这个 Dockerfile:
FROM openjdk:7
WORKDIR /restdocs/
RUN git clone https://github.com/spring-projects/spring-restdocs.git /restdocs
RUN git checkout v1.1.2.RELEASE
RUN ./gradlew build
使用 docker build . -t rest-notes
构建结果出现以下错误:
Exception in thread "main" javax.net.ssl.SSLException: java.security.ProviderException: java.security.InvalidKeyException: EC parameters error
.
我可以在 Dockerfile 中做什么来避免这种情况并使 Gradle 包装器正常工作?
最佳答案
感谢 Erich Seifert 和他的 promise ,我能够解决这个问题:https://github.com/eseifert/gral/commit/c24e08a91952a99b8c8b686a1b172335db8cdf87 。更新后的 Dockerfile 可以工作:
FROM openjdk:7
RUN apt-get update && apt-get install sudo
# Fix the EC parameters error: (ref https://github.com/travis-ci/travis-ci/issues/8503)
RUN sudo wget "https://bouncycastle.org/download/bcprov-ext-jdk15on-158.jar" -O "${JAVA_HOME}"/jre/lib/ext/bcprov-ext-jdk15on-158.jar && \
sudo perl -pi.bak -e 's/^(security\.provider\.)([0-9]+)/$1.($2+1)/ge' /etc/java-7-openjdk/security/java.security && \
echo "security.provider.1=org.bouncycastle.jce.provider.BouncyCastleProvider" | sudo tee -a /etc/java-7-openjdk/security/java.security
WORKDIR /restdocs/
RUN git clone https://github.com/spring-projects/spring-restdocs.git /restdocs
RUN git checkout v1.1.2.RELEASE
RUN ./gradlew build
(不必介意 spring-restdocs 分支的构建失败 - 这与 EC 参数错误无关:)
关于docker - 如何使用openjdk :7 Docker image and a Gradle wrapper?避免 `EC parameters error`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47789963/