Docker Compose 檔案配置
阿新 • • 發佈:2022-05-31
檔案配置示例
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