[Docker Compose] 4.1 Docker Compose 部署 Tomcat

Docker Compose 部署 Tomcat

Posted by Mr.Vincent on 2019-08-22
Estimated Reading Time 1 Minutes
Words 107 In Total
Viewed Times

启动一个 tomcat,先在 /usr/local/docker/tomcat/ 目录下创建一个 docker-compose.yml 配置文件。

docker-compose.yml

1
2
3
4
5
6
7
8
9
10
11
12
version: '3.1'
services:
tomcat:
restart: always
image: tomcat
container_name: tomcat
ports:
- 8080:8080
volumes:
- /usr/local/docker/tomcat/webapps/ROOT:/usr/local/tomcat/webapps/ROOT
environment:
TZ: Asia/Shanghai

运行 compose 项目(运行容器)

1
docker-compose up

删除容器

1
docker-compose down

容器守护态运行

1
docker-compose up -d

查看日志

1
docker-compose logs tomcat

监听日志

1
docker-compose logs -f tomcat

If you like this blog or find it useful for you, you are welcome to comment on it. You are also welcome to share this blog, so that more people can participate in it. If the images used in the blog infringe your copyright, please contact the author to delete them. Thank you !