步骤:
1、创建相应目录
2、编写compose文件
3、运行

1、mkdir -p /opt/tomcat/{conf,webapps,logs}
2、vim /opt/tomcat/tomcat-compose.yml

version: '3'
services:
  tomcat:
    image: tomcat:8.5.60-jdk8-adoptopenjdk-hotspot
    container_name: tomcat1
    restart: always
    ports:
      - 8081:8080
    environment:
      TZ: "Asia/Shanghai"
    volumes:
      - /opt/tomcat1/conf/server.xml:/usr/local/tomcat/server.xml
      - /opt/tomcat1/webapps:/usr/local/tomcat/webapps
      - /opt/tomcat1/logs:/usr/local/tomcat/logs

3、cd /opt/tomcat && docker-compose -f tomcat-compose.yml up -d

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐