2023-12-15 16:17:51 +08:00
|
|
|
version: "3.9"
|
|
|
|
|
|
|
|
services:
|
|
|
|
mariadb:
|
2024-10-11 01:18:00 +08:00
|
|
|
image: mariadb:11.5.2
|
2023-12-15 16:17:51 +08:00
|
|
|
container_name: mariadb
|
|
|
|
hostname: mariadb
|
|
|
|
restart: always
|
|
|
|
networks:
|
|
|
|
- db_network
|
|
|
|
ports:
|
|
|
|
- "3306:3306"
|
|
|
|
volumes:
|
2024-05-22 17:26:00 +08:00
|
|
|
- /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime:ro
|
2023-12-15 16:17:51 +08:00
|
|
|
- mariadb_db:/var/lib/mysql
|
|
|
|
configs:
|
|
|
|
- source: mariadb_conf
|
|
|
|
target: /etc/mysql/conf.d/my.cnf
|
|
|
|
mode: 0444
|
|
|
|
secrets:
|
|
|
|
- mariadb_root_key
|
|
|
|
environment:
|
|
|
|
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/mariadb_root_key
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
mariadb_db:
|
|
|
|
|
|
|
|
configs:
|
|
|
|
mariadb_conf:
|
|
|
|
file: my.cnf
|
|
|
|
|
|
|
|
secrets:
|
|
|
|
mariadb_root_key:
|
|
|
|
file: root.key
|
|
|
|
|
|
|
|
networks:
|
|
|
|
db_network:
|
|
|
|
name: db_network
|
|
|
|
external: true
|
|
|
|
# driver: bridge
|
|
|
|
# driver_opts:
|
|
|
|
# encrypted: 'true'
|
|
|
|
# ipam:
|
|
|
|
# driver: default
|
|
|
|
# config:
|
|
|
|
# - subnet: 172.21.0.1/24
|