无法访问jarfile泊坞窗

时间:2018-07-09 16:59:31

标签: java docker jar

我是docker的新手,正在尝试将简单的Spring Boot应用程序容器化。 docker文件如下。

FROM openjdk:8<br>
RUN mkdir app<br>
ADD target/discovery.jar app/discovery.jar <br>
WORKDIR app<br>
RUN "pwd"<br>
RUN "ls"<br>
EXPOSE 8085<br>
ENTRYPOINT ["java","-jar", "discovery.jar "]

当我尝试运行以上图像时,我得到 “错误:无法访问jarfile Discovery.jar”

  

docker run -p 8085:8085发现

在构建上面的docker映像时输出。

Sending build context to Docker daemon  16.28MB<br>
Step 1/8 : FROM openjdk:8<br>
 ---> fe9f7b1e4fa0<br>
Step 2/8 : RUN mkdir app<br>
 ---> Running in 31cf087f541b<br>
Removing intermediate container 31cf087f541b<br>
 ---> c16f79c1776a<br>
Step 3/8 : ADD target/discovery.jar app/discovery.jar<br>
 ---> ff21016b781f<br>
Step 4/8 : WORKDIR app<br>
Removing intermediate container ec5b68b4d043<br>
 ---> 67fd0e77b057<br>
Step 5/8 : RUN "pwd"<br>
 ---> Running in f3d5f186a75a<br>
/app<br>
Removing intermediate container f3d5f186a75a<br>
 ---> 83928a000887<br>
Step 6/8 : RUN "ls"<br>
 ---> Running in b5c6a4af52cb<br>
discovery.jar<br>
Removing intermediate container b5c6a4af52cb<br>
 ---> d69d7ee14bb3<br>
Step 7/8 : EXPOSE 8085<br>
 ---> Running in 74a675cdd951<br>
Removing intermediate container 74a675cdd951<br>
 ---> 471bce4c390b<br>
Step 8/8 : ENTRYPOINT ["java","-jar", "discovery.jar "]<br>
 ---> Running in b07b26fb3e2f<br>
Removing intermediate container b07b26fb3e2f<br>
 ---> 89e0ed2b16d6<br>
Successfully built 89e0ed2b16d6<br>
Successfully tagged discovery:latest<br>
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended
to double check and reset permissions for sensitive files and directories.

请注意-jar文件位于工作目录中。

谢谢!

1 个答案:

答案 0 :(得分:0)

里面有多余的空间

ENTRYPOINT ["java","-jar", "discovery.jar "]

,因此将其作为文件名的一部分。删除最后的双引号之前的多余空间。