docker 部署 mysql8 的 docker-compose 文件编写

version: '3.4'
services:
  mysql:
    image: mysql:8.0.15
    container_name: platform.mysql.23306
    deploy:
      resources:
        limits:
          memory: 3g
      restart_policy:
        condition: on-failure
    ports:
    - 23306:3306
    command: 
      --default-authentication-plugin=mysql_native_password
      --character-set-server=utf8mb4
      --collation-server=utf8mb4_general_ci
      --explicit_defaults_for_timestamp=true
      --lower_case_table_names=1
    environment:
    - MYSQL_ROOT_PASSWORD=root
    volumes:
    - /etc/localtime:/etc/localtime:ro
    - volumes.mysql8.data:/var/lib/mysql
    configs:
    - source: cfg_mysql
      target: /etc/mysql/my.cnf
networks:
  default: null
volumes:
  volumes.mysql8.data: null
configs:
  cfg_mysql:
    file: ../config/mysql.conf
mysql的基本配置

 

posted @ 2019-09-08 22:35  陈苏乾  阅读(3485)  评论(0编辑  收藏  举报