【发布时间】:2022-06-30 17:26:56
【问题描述】:
这是我的 Dockerfile:
FROM openjdk:8
EXPOSE 8080
ADD target/springboot-example.jar springboot-example.jar
ENTRYPOINT ["java","-jar","/springboot-example.jar"]
在运行docker build 时,我看到了这个错误:
第 3/4 步:添加目标/springboot-example.jar springboot-example.jar
添加失败:在构建上下文中找不到文件或被 .dockerignore 排除:stat target/springboot-example.jar:文件不存在
【问题讨论】:
-
您确定文件
target/springboot-example.jar存在吗?它可能有不同的名称,具体取决于如何配置 jar 名称生成例如,如果您在.jar之前的名称中内置了版本,则可以使用通配符:ADD target/springboot-example*.jar springboot-example.jar -
您是否尝试过指定 WORKDIR?
标签: java spring-boot docker docker-image rancher-desktop