Docker Compose部署项目到容器-基于Tomcat和mysql的项目yml配置文件代码

场景

Docker-Compose简介与Ubuntu Server 上安装Compose:

https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/100902301

Docker Compose基本使用-使用Compose启动Tomcat为例:

https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/100904080

Docker Compose部署项目到容器-基于Tomcat和mysql的商城项目(附源码和sql下载):

https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/100941366

实现

version: '3' 
services: 
  web:
    restart: always 
    image: tomcat 
    container_name: web
    ports:      
      - 8080:8080
    volumes:
      - /usr/local/docker/myshop/ROOT:/usr/local/tomcat/webapps/ROOT
 
  mysql:
    restart: always
    image: mysql:5.7.22
    container_name: mysql
    ports:
      - 3306:3306
    environment:
      TZ: Asia/Shanghai
      MYSQL_ROOT_PASSWORD: 123456
    command:
      --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/mysql

volumes:
  mysql-data:

 

注:

这里是mysql5.7.22


你可能感兴趣的:(Docker Compose部署项目到容器-基于Tomcat和mysql的项目yml配置文件代码)