I am running docker images that start the tomcat8 server, but it does not start

I have a docker image that I create from my docker file. When I run the image, it can start the tomcat server, then the command line is returned. This means the process is ending, and I think the container is stopping. Therefore, when I see http: // localhost: 8080 , the tomcat page does not appear. Therefore, I can not find the actual problem. I'm actually trying to create custom java8, tomcat8 and maven as an environment, and I want to deploy my maven project on this tomcat server. Bellow is a Docker image creation file.

FROM scratch
FROM ubuntu:16.04

RUN mkdir /opt/java8
RUN mkdir /opt/tomcat8
RUN mkdir /opt/maven3

ENV JAVA_HOME /opt/java8
ENV CATALINA_HOME /opt/tomcat8
ENV M2_HOME /opt/maven3

ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin:$M2_HOME/bin

ADD jdk1.8.0_112 /opt/java8
ADD apache-tomcat-8.0.38 /opt/tomcat8
ADD apache-maven-3.3.9 /opt/maven3

EXPOSE 8080

CMD ["startup.sh", "run"]

I put 3 java, tomcat, maven folders near the Docker file so that they are added.

, , .

root@dhavalbhoot:/home/veni/Documents/dhaval_bhoot/docker_images/tomcat1#
  docker run -it -p 8080:8080 dhaval/tomcat:8.0.38

:

Using CATALINA_BASE:   /opt/tomcat8
Using CATALINA_HOME:   /opt/tomcat8
Using CATALINA_TMPDIR: /opt/tomcat8/temp
Using JRE_HOME:        /opt/java8
Using CLASSPATH:       
  \#/opt/tomcat8/bin/bootstrap.jar:/opt/tomcat8/bin/tomcat-juli.jar
Tomcat started.

root@dhavalbhoot:/home/veni/Documents/dhaval_bhoot/docker_images/tomcat1#

, http://localhost:8080 tomcat .

+4
1

docker official tomcat image (8.0.40) :

CMD ["catalina.sh", "run"]

catalina.sh , tomcat : .
tomcat script, startup.sh.

tomcat :

$ docker run -it --rm -p 8080:8080 tomcat:8.0

, http://container-ip:8080

+4

Source: https://habr.com/ru/post/1679405/


All Articles