Reputation: 3139
I have a rather strange problem. I am trying to run a Spring Boot app via docker. So here are my steps.
1) I am creating a Dockerfile.
FROM centos
RUN yum install -y java
VOLUME /tmp
ADD /spring-boot-web-0.0.1-SNAPSHOT.jar myapp.jar
RUN sh -c 'touch /myapp.jar'
ENTRYPOINT [“java","-Djava.security.egd=file:/dev/./urandom","-
jar","/myapp.jar"]
In this file I am installing java. I am also using the jar file of the app called spring-boot-web-0.0.1-SNAPSHOT.jar
2) The next step is to build an image. So I am typing
tmp theodosiostziomakas$ docker build -t spring-boot-docker .
So the image was built correctly.
3) Now I am running that image to generate a container. So
docker run -d -p 8080:8080 spring-boot-docker
You can see that a container is generated. But when I type
$ docker ps
the container_id is not visible and when I type localhost:8080 in the browser the app is not running at all. Why is this happening? Any ideas? How to fix it?
Upvotes: 0
Views: 5006
Reputation: 36103
If the posted Dockerfile the file you are using then there is a wrong quote sign just before java:
FROM centos
RUN yum install -y java
VOLUME /tmp
ADD /spring-boot-web-0.0.1-SNAPSHOT.jar myapp.jar
RUN sh -c 'touch /myapp.jar'
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/myapp.jar"]
Upvotes: 2