获取镜像

  1. # 查看可用的稳定版本
  2. sudo docker search tomcat
  3. sudo docker pull tomcat:8.5-jre8
  4. sudo docker image ls |grep tomcat

创建数据卷

  1. sudo mkdir -p /var/local/bdb_admin/admin_web
  2. sudo mkdir -p /share/tomcat/logs
  3. sudo mkdir -p /share/tomcat/upload

服务编排

mkdir -p /share/tomcat
vi /share/tomcat/docker-compose.yml

服务编排内容如下:

version: "3"
services:
  admin:
    image: tomcat:8.5-jre8
    container_name: admin
    ports:
      - "80:8080"
    volumes:
      - /var/local/bdb_admin/admin_web:/usr/local/tomcat/webapps
      - /share/tomcat/logs/:/usr/logs/
      - /share/tomcat/upload/:/usr/upload/
      - /etc/localtime:/etc/localtime
    environment:
      - JAVA_OPTS=-Duser.timezone=GMT+08

Web UI:http://192.168.0.99