DockerFile之创建Tomcat镜像

一 安装Tomcat镜像的步骤

  1. 准备镜像文件

    Tomcat压缩包 JDK压缩包
    放到Dockfile同一文件夹
    这里就不挂文件了到处都有

  2. 编写dockerfile
vim Dockerfile #官方推荐的名字

#在vim文本编辑框中敲入如下命令

FROM centos
MAINTAINER Yang<[email protected]>

COPY /user/local/myInfo.txt /user/local/myInfo.txt

ADD jdk-8ull-linux-x64.tar.gz /user/local/
ADD apache-tomcat-9.0.22.tar.gz /usr/loacl/

RUN yum -y install vim

ENV MYPATH /user/local

WORKPATH $MYPATH

ENV JAVA_HOME /user/local/jdk1.8.0_11
ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
ENV CATALINA_HOME /user/local/apache-tomcat-9.0.22
ENV CATALINA_BASH /user/local/apache-tomcat-9.0.22
ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME

EXPOSE 8080

CMD user/local/apache-tomcat-9.0.22/bin/startup.sh && tail -F /url/local/apache-tomcat-9.0.22/bin/logs/catalina.out
  1. docker build Dockerfile -t mytomcat:0.1 . #这个点是灵魂啊没有是不行的

你可能感兴趣的:(centos,docker,容器,java,tomcat)