docker部署生产环境下的tomcat
1. dockerfile文件
FROM tomcat:7-jre8 WORKDIR /etc COPY ./Shanghai /etc/localtime WORKDIR /usr/share/zoneinfo/Asia COPY ./Shanghai /usr/share/zoneinfo/Asia/Shanghai COPY ./catalina.sh /usr/local/tomcat/bin COPY ./fonts /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/fonts WORKDIR /usr/local/tomcat/
其中fonts文件夹,catalina.sh,shanghai(区域文件). 这三个文件放在dockerfile当前目录下,需要注意的是catalina.sh需要添加执行权限,否则会报错
2. docker-compose文件
version: "2" services: tomcat: build: ./tomcat container_name: leshanzhiye restart: always environment: - TZ=Asia/Shanghai volumes: - ./axinfu/:/root/axinfu/ - ./upload:/usr/local/tomcat/upload - ./download:/usr/local/tomcat/download - ./webapps:/usr/local/tomcat/webapps - /mnt/leshanzhiye:/usr/local/tomcat/logs ports: - "8048:8080"
努力生活,融于自然