Tomcat’s Dockerfile

  docker, question

I wrote one myself.tomcatTheDockerfileDocuments,docker buildAfter the implementationdocker runThe container was withdrawn directly.tomcatDid not open

Dockerfile
FROM debian:lite
 LABEL maintainer "jervain@126.com"
 # Need jdk-8u121-linux-x64.tar.gz
 # Need apache-tomcat-8.0.42.tar.gz
 ENV JDK_VERSION 1.8.0_121
 ENV TOMCAT_VERSION 8.0.42
 ENV CATALINA_HOME /usr/local/tomcat
 ENV JAVA_HOME /usr/local/java
 ENV SRC_DIR /home/tmp
 
 WORKDIR ${SRC_DIR}
 
 COPY  jdk-8u121-linux-x64.tar.gz ${SRC_DIR}
 COPY  apache-tomcat-8.0.42.tar.gz ${SRC_DIR}
 
 RUN tar -xf  jdk-8u121-linux-x64.tar.gz \
 && tar -xf  apache-tomcat-8.0.42.tar.gz \
 && mv jdk${JDK_VERSION} ${JAVA_HOME} \
 && mv apache-tomcat-${TOMCAT_VERSION} ${CATALINA_HOME} \
 && export JAVA_HOME="${JAVA_HOME}" \
 && export CLASSPATH=".:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar" \
 && export CATALINA_HOME="${CATALINA_HOME}" \
 && export PATH="$JAVA_HOME/bin:$PATH" \
 && chmod +x ${CATALINA_HOME}/bin/startup.sh \
 && chmod +x ${CATALINA_HOME}/bin/shutdown.sh \
 && rm -rf ./*
 
 ENTRYPOINT [${CATALINA_HOME}"/bin/startup.sh"]
 EXPOSE 80 8080
 VOLUME [${CATALINA_HOME}"/conf","/var/www/webapps"]

My orders:docker build -t tomcat:8.0.42 .Anddocker run -itd tomcat:8.0.42 /bin/bashThe container exited directly after the execution was completed. Please help me see what’s wrong with Dockerfile. I don’t know if it was because the. sh file exited after the execution was completed. By the wayDockerfileInENTRYPOINTThere are two formatsshAndexec,shAndexecCan you give me an example of how to use the format of

There needs to be a foreground process, such as a casual tail -f file or something.