maven打包项目到docker的时候:ADD failed: stat xxx: no such file or directory

Step 3/4 : ADD springboot-0.0.1.jar app.jar

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.710 s
[INFO] Finished at: 2018-11-17T09:01:01+08:00
[INFO] Final Memory: 32M/218M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:1.0.0:build (default-cli) on project springboot: Exception caught: ADD failed: stat /var/lib/docker/tmp/docker-builder955781350/springboot-0.0.1.jar: no such file or directory -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.

这是dockerfile的内容:
FROM openjdk:8-jdk-alpine
VOLUME /tmp
ADD springboot-0.0.1.jar app.jar
ENTRYPOINT ["java","Djava.security.egd=file:/dev/.urandom","-jar","/app.jar"]

1个回答

先打包,比如打包在target,dockerfile文件要跟jar包在同一目录下面。

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问