【发布时间】:2020-10-22 09:16:45
【问题描述】:
FROM java:8
FROM maven:alpine
WORKDIR /app
COPY pom.xml /app
RUN mvn clean
RUN mvn compile
RUN mvn install
COPY . /app
RUN mvn clean install
ENTRYPOINT ["java", "-jar", "/target/Brabo-Asset-Service-Web-0.0.1-SNAPSHOT-spring-boot.jar"]
收到此错误:
java: /app/src/main/java (add: main, clean: false, plugin: null, outputOptions: null)
[INFO] grpc-java: /app/src/main/java (add: main, clean: false, plugin: null, outputOptions: null)
[INFO] Resolving artifact: io.grpc:protoc-gen-grpc-java:1.15.0, platform: linux-x86_64
[INFO] Processing (java): NodeLevelService.proto
protoc-jar: executing: [/root/protocjar8340208475023305576/bin/protoc.exe, -I/tmp/protocjar1489995214004248376/include, -I/app/src/main/resources, --java_out=/app/src/main/java, /app/src/main/resources/NodeLevelService.proto]
protoc-jar: caught exception, retrying: java.io.IOException: Cannot run program "/root/protocjar8340208475023305576/bin/protoc.exe": error=2, No such file or directory
protoc-jar: executing: [/root/protocjar8340208475023305576/bin/protoc.exe, -I/tmp/protocjar1489995214004248376/include, -I/app/src/main/resources, --java_out=/app/src/main/java, /app/src/main/resources/NodeLevelService.proto]
protoc-jar: caught exception, retrying: java.io.IOException: Cannot run program "/root/protocjar8340208475023305576/bin/protoc.exe": error=2, No such file or directory
protoc-jar: executing: [/root/protocjar8340208475023305576/bin/protoc.exe, -I/tmp/protocjar1489995214004248376/include, -I/app/src/main/resources, --java_out=/app/src/main/java, /app/src/main/resources/NodeLevelService.proto]
【问题讨论】:
-
你永远不会使用图像
java:8。您可以安全地将其从 Dockerfile 中删除 -
可以分享一下pom文件吗?看起来问题就在那里。
-
@Stefano 我正在使用 openjdk:8
-
您使用的是来自 maven 的 jvm,顺便说一下是 java 8,但您没有使用 docker 映像
java:8。您应该检查多阶段构建在 docker 中的工作方式。
标签: java docker docker-compose dockerfile devops