-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
31 lines (30 loc) · 921 Bytes
/
Copy pathdocker-compose.yml
File metadata and controls
31 lines (30 loc) · 921 Bytes
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
version: "3.8"
services:
mongo1:
image: mongo:4.2
container_name: mongo1
volumes:
- ~/mongors/data1:/data/db
ports:
- 27021:27021
command: [ "--bind_ip_all", "--replSet", "dbrs", "--port", "27021" ]
healthcheck:
test: test $$(echo "rs.initiate({_id:'dbrs',members:[{_id:0,host:\"mongo1:27021\"},{_id:1,host:\"mongo2:27022\"},{_id:2,host:\"mongo3:27023\"}]}).ok || rs.status().ok" | mongo --port 27021 --quiet) -eq 1
interval: 10s
start_period: 30s
mongo2:
image: mongo:4.2
container_name: mongo2
volumes:
- ~/mongors/data2:/data/db
ports:
- 27022:27022
command: [ "--bind_ip_all", "--replSet", "dbrs", "--port", "27022" ]
mongo3:
image: mongo:4.2
container_name: mongo3
volumes:
- ~/mongors/data3:/data/db
ports:
- 27023:27023
command: [ "--bind_ip_all", "--replSet", "dbrs", "--port", "27023" ]