Docker镜像打包示例
一、war包(SpringMVC项目)镜像部署 1、拉取tomcat镜像 docker pull tomcat:8.5.30 2、上传需要部署的war包(以hello.war为例)到自定义的工作目录下 3、在上个步骤创建的工作目录下创建Dockerfile文件。将war包和Dockerfile文件放在同一目录下。Dockerfile文件内容如下: from tomcat:8.5.30 ENV LANG C.UTF-8 ENV TZ=Asia/Shanghai ENV JAVA_OPTS "-Djava.awt.headless=true" RUN touch /usr/local/tomcat/bin/setenv.sh && chmod +x /usr/local/tomcat/bin/setenv.sh && echo "CLASSPATH=/xx/hello" >/usr/local/tomcat/bin/setenv.sh RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN rm -rf /usr/local/tomcat/webapps/* ADD hello.war /usr/local/tomcat/webapps/ WORKDIR /usr/local