1

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"]
stackeption
  • 11
  • 1
  • 3

1 Answers1

0

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

Dockerfile

...
COPY resources /home/
COPY elk_casino_server /home/
...
grapes
  • 8,185
  • 1
  • 19
  • 31
  • now it just saves the content of the resources and elk_casino_server folder into /home but now cant even build because paths are not the same – stackeption Jan 11 '19 at 10:14