简介
docker-compose是
Samples
MySQL
version: '3'
services:
mysql:
image: mysql:8.3.0
container_name: mysql
restart: unless-stopped
command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci --default-authentication-plugin=mysql_native_password
environment:
- TZ=Asia/Shanghai
- LANG=zh_CN.UTF-8
- MYSQL_ROOT_HOST=%
- MYSQL_ROOT_PASSWORD=zQajzMsVs0@
ports:
- 3306:3306
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
volumes:
- ./volumes/db/conf:/etc/mysql/conf.d
- ./volumes/db/conf/my.cnf:/etc/mysql/my.cnf
- ./volumes/db/data:/var/lib/mysql
- ./volumes/db/logs:/var/log/mysql
- ./volumes/db/init:/docker-entrypoint-initdb.d
About 1 min