I have Dockerfile with this text:

FROM java:8
COPY . /var/www/java
WORKDIR /var/www/java
RUN javac Sample.java
CMD ["java", "Sample"]

I am ok to build this Dockerfile and to run that image.

But I do not want to run just one Sample.java file. I want to run whole eclipse java project. I copy eclipse project folder to docker container. Like that:

COPY /Project /

My project exists in the Project folder. And I cannot run that project. How can I do? You can look my eclipse java project from this link


  • Could you explain why you would like to use docker for this purpose? What are you trying to achieve? – 030 Sep 8 at 9:29
  • Does eclipse have a headless (no GUI) mode? – avi Sep 9 at 7:28
  • I am trying to host and run my university academic projects(php, J2SE, android,etc) in my website by dockerizing each project.For Java,I can dockerize the uploaded executable jar file but i can't dockerize the uploaded project folder. – Htet Khant Sep 9 at 10:56
  • The download is not working. Imho you should introduce Maven to these projects. This works then well both wit Eclipse and Docker. I.e. pom.xml gives good abstraction from javac. Also, checkout Docker multistage builds! – Peter Sep 14 at 21:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.