dockerfile部署tomcat+jdk
Posted kkblog
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了dockerfile部署tomcat+jdk相关的知识,希望对你有一定的参考价值。
FROM centos:7 MAINTAINER www.ctnrs.com ENV VERSION=8.0.46 RUN yum install wget curl unzip iproute net-tools -y && yum clean all && rm -rf /var/cache/yum/* COPY jdk-8u45-linux-x64.tar.gz / RUN tar zxf jdk-8u45-linux-x64.tar.gz -C /usr/local/ #RUN yum install java-1.8.0-openjdk wget curl unzip iproute net-tools -y && # yum clean all && # rm -rf /var/cache/yum/* #RUN wget http://mirrors.shu.edu.cn/apache/tomcat/tomcat-8/v${VERSION}/bin/apache-tomcat-${VERSION}.tar.gz && COPY apache-tomcat-8.0.46.tar.gz / RUN tar zxf apache-tomcat-${VERSION}.tar.gz && mv apache-tomcat-${VERSION} /usr/local/tomcat && rm -rf apache-tomcat-${VERSION}.tar.gz /usr/local/tomcat/webapps/* && mkdir /usr/local/tomcat/webapps/test && echo "ok" > /usr/local/tomcat/webapps/test/status.html && sed -i ‘1a JAVA_OPTS="-Djava.security.egd=file:/dev/./urandom"‘ /usr/local/tomcat/bin/catalina.sh && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime #ENV PATH $PATH:/usr/local/tomcat/bin #ENV JAVA_HOME /usr/local/jdk1.8.0_45 ENV JAVA_HOME /usr/local/jdk1.8.0_45 ENV CATALINA_HOME /usr/local/tomcat ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin WORKDIR /usr/local/tomcat EXPOSE 8080 CMD ["catalina.sh", "run"]
docker run
docker volume create tomcat_vol
docker run -itd --name tomcat -p 8080:8080 -v tomcat_vol:/usr/local/tomcat/webapps tomcat:v1
以上是关于dockerfile部署tomcat+jdk的主要内容,如果未能解决你的问题,请参考以下文章