docker部署nacos配置mysql

version: "3"
services:
        mysql:
                restart: always
                image: mysql:latest
                container_name: cloud_mysql
                volumes:
                        - /data01/mysql/datadir:/var/lib/mysql
                        - /data01/mysql/conf:/etc/mysql/conf.d
                        - /data01/mysql/logs:/logs
                command:
                        --character-set-server=utf8mb4
                        --collation-server=utf8mb4_general_ci
                        --explicit_defaults_for_timestamp=true
                        --default-authentication-plugin=mysql_native_password
                environment:
                        MYSQL_ROOT_PASSWORD: "root"
                        MYSQL_ROOT_USER: "root"
                        MYSQL_INITDB_SKIP_TZINFO: "Asia/Shanghai"
                ports:
                        - 3306:3306
                networks:
                        - cloudnet
        nacos51:
                restart: always
                image: nacos/nacos-server
                container_name: nacos51
                depends_on:
                        - mysql
                environment:
                        MODE: standalone
                        SPRING_DATASOURCE_PLATFORM: "mysql"
                        MYSQL_SERVICE_HOST: "cloud_mysql"
                        MYSQL_SERVICE_PORT: "3306"
                        MYSQL_SERVICE_USER: "root"
                        MYSQL_SERVICE_PASSWORD: "root"
                        MYSQL_SERVICE_DB_NAME: "nacos_config"
                        MYSQL_SERVICE_DB_PARAM: "useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8"
                ports:
                        - 8851:8848
                networks:
                        - cloudnet

networks:
        cloudnet:
                driver: bridge
posted @ 2022-10-18 00:16  周XX  阅读(243)  评论(0编辑  收藏  举报