文件配置示例

version: '3.4'

services:
  docktest2:
    image: docktest2:latest
    build:
      context: .
      dockerfile: DockTest2/Dockerfile
    environment:
      LANG: C.UTF-8  
    depends_on:
      - redis
      - dbmysql

  redis:
    image: redis:latest
    ports:
      - "6777:6739"
  
  dbmysql:
        image: mysql
        container_name: dbmysql 
        command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --default-authentication-plugin=mysql_native_password 
        restart: always
        environment:
          LANG: C.UTF-8  
          MYSQL_ROOT_PASSWORD: root 
          MYSQL_USER: test   
          MYSQL_PASSWORD: test  
        ports:
          - '3307:3306'  
        volumes:
          - "/d/DockerVolumes/mysql/data/db:/var/lib/mysql"  
          - "/d/DockerVolumes/mysql/data/conf:/etc/mysql/conf.d"

 

出现中文乱码的时候:加入

    environment:
      LANG: C.UTF-8  

VS中直接点击项目文件夹添加

 

自动生成配置文件

 

完整项目示例:  https://pan.baidu.com/s/1czrp484sOHgyR3-HJ2YPdQ?pwd=ee7w  

 

posted on 2022-05-31 18:03  wxm3177  阅读(68)  评论(0编辑  收藏  举报