mysql、redis、asp.net core项目应用程序三个常见的docker-compose文件模板参考:
代码语言:javascript复制version: "3"
services:
mysql:
restart: always
image: hub.duoyioa.com/public/mysql:5.7.18
container_name: ${SERVICE_NAME}-mysql
command: [
"--log-bin=mysql-bin",
"--log-error=error.err",
"--server-id=1002",
"--character-set-server=utf8mb4",
"--collation-server=utf8mb4_unicode_ci",
"--innodb_flush_log_at_trx_commit=1",
"--sync_binlog=1",
"--gtid_mode=ON",
"--enforce_gtid_consistency=ON",
"--master_info_repository=TABLE",
"--relay_log_info_repository=TABLE",
"--binlog_checksum=NONE",
"--log_slave_updates=ON",
"--binlog_format=ROW",
"--transaction_write_set_extraction=XXHASH64",
"--loose-group_replication_group_name='ce9be252-2b71-11e6-b8f4-00212844f856'",
"--loose-group_replication_start_on_boot=off",
"--loose-group_replication_local_address='192.168.92.133:3306'",
"--loose-group_replication_group_seeds='192.168.92.132:3306, 192.168.92.133:3306'",
"--loose-group_replication_bootstrap_group=off",
"--loose-group_replication_ip_whitelist='192.168.92.132,192.168.92.133'"
]
volumes:
- /etc/localtime:/etc/localtime:ro
- /opt/developer/db:/var/lib/mysql
ports:
- "3306:3306"
networks:
- developer
env_file: ${SERVICE_PATH}/config/mysql/account.env
environment:
MYSQL_DATABASE: devCentre
MYSQL_USER: devCentre
redis:
restart: always
image: hub.duoyioa.com/public/redis:3.2.11
container_name: ${SERVICE_NAME}-redis
volumes:
- /etc/localtime:/etc/localtime:ro
networks:
- developer
web:
restart: always
image: hub.duoyioa.com/public/aspnetcore:2.0.3
container_name: ${SERVICE_NAME}
command: dotnet Developer.API.dll
volumes:
- /etc/localtime:/etc/localtime:ro
- /var/websync/developer_web/running:/app
- /var/webconfig/developer:/var/webconfig/developer
- /var/webos/logs/developer:/var/webos/logs/developer
working_dir: /app
depends_on:
- mysql
- redis
ports:
- "10801:5003"
networks:
- developer
networks:
developer:
docker基础可参考:
docker——从入门到实践 Docker Compose 简介