获取镜像
# 查看可用的稳定版本
sudo docker search tomcat
sudo docker pull tomcat:8.5-jre8
sudo docker image ls |grep tomcat
创建数据卷
sudo mkdir -p /var/local/bdb_admin/admin_web
sudo mkdir -p /share/tomcat/logs
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