Dockerfile构建自己的tomcat项目

拉取基础镜像较慢

[root@txy-150-110 ~]# cat /etc/docker/daemon.json
{
    "log-driver": "json-file",
    "log-opts": {
        "max-size": "1G",
        "max-file": "3"
    },
    "exec-opts": ["native.cgroupdriver=systemd"],
    "registry-mirrors": [
  "https://mirror.ccs.tencentyun.com",
        "https://dockerhub.azk8s.cn"
    ],
    "max-concurrent-downloads": 10,
    "max-concurrent-uploads": 10,
    "graph": "/export/docker_root_dir",
    ]
}

重启docker服务

将自己的war包放入到tomcat镜像里

FROM tomcat:8-jre8-alpine
ENV LANG en_US.UTF-8
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo "Asia/Shanghai" > /etc/timezone
RUN ["rm","-rf","/usr/local/tomcat/webapps/*"]
ADD target/test-test.war /usr/local/tomcat/webapps/
RUN echo http://mirrors.aloyun.com/alpine/v3.7/main > /etc/apk/repositories && \
    echo http://mirrors.aloyun.com/alpine/v3.7/community >> /etc/apk/repositories
#RUN ["apk","--update","add","fontconfig","ttf-dejavu"]
#解决docker alpine缺少字体的问题
ENTRYPOINT ["catalina.sh","run"]

 

你可能感兴趣的:(Kubernetes,Docker)