tomcat的Dockerfile编写
我想大声告诉你
我想大声告诉你 2017-04-27 09:03:18
0
2
742

我自己编写的一个tomcatDockerfile文件,docker build后在执行docker run,容器直接退出了,tomcat并没有开启

Dockerfile
FROM debian:lite
LABEL maintainer "jervain@126.com"
#需要jdk-8u121-linux-x64.tar.gz
#需要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"]

我执行的命令:docker build -t tomcat:8.0.42 .docker run -itd tomcat:8.0.42 /bin/bash执行完成后容器直接退出了,请各位帮我看下Dockerfile有什么问题,不知道是不是因为.sh文件执行完成后就退出了,顺便问下DockerfileENTRYPOINT有两种格式shexecshexec的格式具体是怎么用的,能否举个例子

我想大声告诉你
我想大声告诉你

reply all(2)
洪涛

You need a foreground process, such as just tail -f a file or something

小葫芦

The two formats of ENTRYPOINT are sh and exec
sh:curl -s http://www.baidu.com

格式为: 命令 [参数] [参数...]

exec:["curl","-s","http://www.baidu.com"]

格式为: ["命令","参数","参数..."]
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template