美文网首页工作生活
Docker Compose实战

Docker Compose实战

作者: Lucie_xxm | 来源:发表于2019-07-02 15:52 被阅读0次

    MySQL5

    version: '3.1'
    services:
      mysql:
        restart: always
        image: mysql
        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:
    

    MySQL8

    version: '3.1'
    services:
      db:
        image: mysql
        restart: always
        environment:
          MYSQL_ROOT_PASSWORD: 123456
        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
        ports:
          - 3306:3306
        volumes:
          - ./data:/var/lib/mysql
    
      adminer:
        image: adminer
        restart: always
        ports:
          - 8080:8080
    

    tomcat

    version: '3.1'
    services:
      tomcat:
        restart: always
        image: tomcat
        container_name: tomcat
        ports:
          - 8080:8080
        volumes:
          - /usr/local/docker/tomcat/webapps/test:/usr/local/tomcat/webapps/test
        environment:
          TZ: Asia/Shanghai
    

    相关文章

      网友评论

        本文标题:Docker Compose实战

        本文链接:https://www.haomeiwen.com/subject/irxthctx.html