youtu_server/docker-compose.yaml

48 lines
1.3 KiB
YAML
Raw Normal View History

2025-01-20 01:55:44 +08:00
version: "3"
services:
mysql:
image: mysql
container_name: mysql
restart: always
command: [
'--character-set-server=utf8mb4',
'--collation-server=utf8mb4_general_ci',
'--explicit_defaults_for_timestamp=true',
'--lower_case_table_names=1'
]
environment:
MYSQL_ROOT_PASSWORD: youtu!0113
MYSQL_INITDB_SKIP_TZINFO: "Asia/Shanghai"
MYSQL_DATABASE: ecpm
volumes:
#数据目录,要确保先创建好
- ./data/mysql/data:/var/lib/mysql
- ./data/mysql/logs:/var/log/mysql
##初始化的脚本初始化我们存放的init.sql文件
2025-01-20 17:36:03 +08:00
- ./data/sql:/docker-entrypoint-initdb.d/
2025-01-20 01:55:44 +08:00
- ./data/mysql/conf:/etc/mysql/conf.d
ports:
- "3306:3306"
healthcheck:
test: [ "CMD", "mysqladmin", "ping", "-h", "localhost", "-uyoutu", "-pyoutu!0113" ]
interval: 6s
timeout: 5s
retries: 10
#network_mode: host
redis:
image: redis
restart: always
hostname: redis
container_name: redis
privileged: true
ports:
- "6379:6379"
environment:
TZ: Asia/Shanghai
volumes:
- ./data/redis:/data
# - ./conf/redis.conf:/etc/redis/redis.conf
- ./data/redis/logs:/logs
# command: [ "redis-server","/etc/redis/redis.conf" ]