-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcompose.yaml
63 lines (61 loc) · 1.86 KB
/
compose.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
services:
consul:
image: hashicorp/consul:latest
ports:
- 8500:8500
etcd:
image: bitnami/etcd:3.5.14
container_name: etcd
ports:
- "2379:2379"
- "2380:2380"
environment:
- ALLOW_SINGLE_CLUSTER=true
- TZ=Asia/Shanghai
- ALLOW_NONE_AUTHENTICATION=yes
nacos:
image: nacos/nacos-server:v2.4.0
container_name: nacos
ports:
- "8848:8848"
- "9849:9849"
- "9849:9849"
volumes:
- ./nacos/logs:/home/nacos/logs
- ./nacos/data:/home/nacos/data
environment:
- PREFER_HOST_MODE=hostname
- MODE=standalone
networks:
- micro-service-net
sentinel:
image: bladex/sentinel-dashboard:1.8.7
container_name: sentinel
ports:
- "8858:8858"
networks:
- micro-service-net
redis:
image: redis:6.2.6
container_name: redis
ports:
- "6379:6379"
networks:
- micro-service-net
mysql:
image: mysql:8.0 # 使用MySQL官方镜像,版本8
restart: always # 容器退出后总是重启
environment:
MYSQL_ROOT_PASSWORD: 88888888 # 设置root用户的密码,生产环境中请使用更复杂的密码
MYSQL_DATABASE: go-zero-demo # 初始化时创建的数据库名称
MYSQL_USER: go-zero # 创建的新用户
MYSQL_PASSWORD: 88888888 # 新用户的密码
ports:
- "3306:3306" # 映射容器的3306端口到主机的3306端口
volumes:
- db_data:/var/lib/mysql # 挂载宿主机的目录到容器的MySQL数据目录,用于持久化数据
networks:
micro-service-net:
driver: bridge
volumes:
db_data: