Docker错误:无法找到或加载Main类Main.Main

时间:2019-01-11 10:06:41

标签: java linux docker jar .class-file

我已经对此Dockerfile进行了编码,该Dockerfile从项目中生成了可运行的jar,并且也进行了构建,但是当我尝试运行它时,它显示“错误:找不到或加载Main类Main.Main”。

Dockerfile:

RUN yum install -y java-1.8.0-openjdk.x86_64  java-1.8.0-openjdk- 
devel.x86_64 && yum clean all

COPY resources /home/resources
COPY elk_casino_server /home/elk_casino_server
RUN /usr/bin/javac /home/elk_casino_server/src/Main/Main.java
RUN jar vcmf /home/elk_casino_server/src/META-INF/MANIFEST.MF 
/home/elk_casino_server/src/server.jar
/home/elk_casino_server/src/Main/Main.class 
/home/elk_casino_server/src/config.properties
CMD ["java","-jar","/home/elk_casino_server/src/server.jar"]

1 个答案:

答案 0 :(得分:0)

Docker COPY命令接受 path 作为第二个参数。尝试更改您的Dockerfile

Dockerfile

...
COPY resources /home/
COPY elk_casino_server /home/
...