Docker Error: Could not find or load Main class Ma

2019-08-17 02:35发布

I have coded this Dockerfile that makes a runnable jar out of a project and it also builds but when i try to run it, it says "Error: Could not find or load Main class 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条回答
Ridiculous、
2楼-- · 2019-08-17 03:11

Docker COPY command accepts path as a second parameter. Try changing your Dockerfile

Dockerfile

...
COPY resources /home/
COPY elk_casino_server /home/
...
查看更多
登录 后发表回答