Answer the question
In order to leave comments, you need to log in
How to run jar file in docker container?
Dockerfile
FROM java:8 #Try
the same with FROM ubuntu
#RUN apt install -y openjdk-8-jdk
RUN mkdir -p /vagrant/Docker/app
WORKDIR /vagrant/Docker/app
COPY . /vagrant/Docker/app
#
EXPOSE 9000
ENV TZ Europe/Yekaterinburg
CMD ["-jar", "/vagrant/Docker/app/app.jar"]
Error with java image:
docker: Error response from daemon: OCI runtime create failed : container_linux.go:380: starting container process caused: exec: "-jar": executable file not found in $PATH: unknown.
Error with ubuntu image:
Error: Unable to access jarfile app.jar
Through the Linux command line, the file launch looks like java -jar app.jar. And what to use CMD or ENTRYPOINR for this? And what will the structure look like?
Answer the question
In order to leave comments, you need to log in
WORKDIR
RUN mkdir -p ...
- creates a directory by itself, it is not necessary to call it separately .
EXPOSE 9000
you can not specify - it does nothing.
Through the Linux command line, the file launch looks like java -jar app.jar
ENTRYPOINT ["java", "-jar", "/vagrant/Docker/app/app.jar"]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question