linux wget下载tomcat8:
wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.5.31/bin/apache-tomcat-8.5.31.tar.gz
运行:
docker run -d -p 81:8080 tomcat:test --name tomtest
进入容器: tomtest 容器名称或者容器id
docker exec -it tomtest bash
制作tomcat的 Dockerfile:
FROM jdk8
COPY ./start.sh /usr/local/
RUN chmod +x /usr/local/start.sh
RUN mkdir tools && cd tools && \
wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-8/v8.5.31/bin/apache-tomcat-8.5.31.tar.gz -O tomcat8.tar.gz && mkdir /usr/local/tomcat8 && \
tar zxvf tomcat8.tar.gz --strip-components 1 -C /usr/local/tomcat8
ENV CATALINA_HOME /usr/local/tomcat8
ENV PATH $PATH:$CATALINA_HOME/bin
EXPOSE 8080
ENTRYPOINT ["/usr/local/start.sh"]
start.sh文件下载路径: COPY ./start.sh /usr/local/
https://pan.baidu.com/s/1HWl5VabKQ_g-7E4p3O9iaw
简洁版本:
如果本地已经有下载好的tomcat8 :
FROM jdk8
COPY ./start.sh /usr/local/
COPY tomcat8 /usr/local/tomcat8
RUN chmod +x /usr/local/start.sh
ENV CATALINA_HOME /usr/local/tomcat8
ENV PATH $PATH:$CATALINA_HOME/bin
EXPOSE 8080
ENTRYPOINT ["/usr/local/start.sh"]
网友评论