我想通过gradle创建我的应用程序的docker映像:
build.gradle
PG::ConnectionBad at /
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
Dockerfile:
task buildDocker (type:Docker, dependsOn: build) {
applicationName = jar.baseName
dockerfile = file('Dockerfile')
doFirst {
copy {
from jar
into stageDir
}
}
}
但是在执行的最后我得到了这个错误:
FROM openjdk:8-jdk-alpine
VOLUME /tmp
EXPOSE 8083
ADD build/libs/app-0.0.1-SNAPSHOT.jar app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
我尝试了很多事情-重命名文件夹,更改路径等。任何看起来都不起作用的东西。
而且我不明白为什么会收到此错误,因为存在以下文件:BUILD FAILED in 28s
7 actionable tasks: 3 executed, 4 up-to-date
Docker execution failed
Command line [docker build -t com.project/app:0.0.1-SNAPSHOT /home/adrian/IdeaProjects/App/build/docker] returned:
ADD failed: stat /var/lib/docker/tmp/docker-builder669437080/build/libs/app-0.0.1-SNAPSHOT.jar: no such file or directory
11:22:34 AM: Task execution finished 'buildDocker'.
。
答案 0 :(得分:0)
目标字段中的用户绝对路径
ADD your_path/yourfile /app.jar