创建 docker-compose.yml
version: '3'
services:web:restart: alwaysimage: tomcatcontainer_name: webports:- 8080:8080volumes:- /usr/local/docker/yuublog/ROOT/:/usr/local/tomcat/webapps/ROOT/environment:TZ: Asia/Shanghaimysql:restart: alwaysimage: mysql:5.7.22container_name: mysqlports:- 3306:3306environment:TZ: Asia/ShanghaiMYSQL_ROOT_PASSWORD: 123456command:--character-set-server=utf8mb4--collation-server=utf8mb4_general_ci--explicit_defaults_for_timestamp=true--lower_case_table_names=1--max_allowed_packet=128M--sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO"volumes:- mysql-data:/var/lib/mysqlvolumes:mysql-data:
启动容器
docker-compose up