-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose-mongo.yml
56 lines (54 loc) · 1.71 KB
/
docker-compose-mongo.yml
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
version : '3.3'
services:
mongo-setup:
container_name: mongo-setup
image: mongo
restart: always
networks:
default:
volumes:
- ./scripts:/scripts
entrypoint: [ "/scripts/setup.sh" ] # Make sure this file exists (see below for the setup.sh)
depends_on:
- mongo1
- mongo2
- mongo3
mongo1:
hostname: mongo1
container_name: localmongo1
image: mongo
expose:
- 27017
ports:
- 27017:27017
restart: always
entrypoint: [ "/usr/bin/mongod", "--bind_ip_all", "--replSet", "rs0", "--journal", "--dbpath", "/data/db", "--enableMajorityReadConcern", "false" ]
volumes:
- <VOLUME-DIR>/mongo/data1/db:/data/db # This is where your volume will persist. e.g. VOLUME-DIR = ./volumes/mongodb
- <VOLUME-DIR>/mongo/data1/configdb:/data/configdb
mongo2:
hostname: mongo2
container_name: localmongo2
image: mongo
expose:
- 27017
ports:
- 27018:27017
restart: always
entrypoint: [ "/usr/bin/mongod", "--bind_ip_all", "--replSet", "rs0", "--journal", "--dbpath", "/data/db", "--enableMajorityReadConcern", "false" ]
volumes:
- <VOLUME-DIR>/mongo/data2/db:/data/db # Note the data2, it must be different to the original set.
- <VOLUME-DIR>/mongo/data2/configdb:/data/configdb
mongo3:
hostname: mongo3
container_name: localmongo3
image: mongo
expose:
- 27017
ports:
- 27019:27017
restart: always
entrypoint: [ "/usr/bin/mongod", "--bind_ip_all", "--replSet", "rs0", "--journal", "--dbpath", "/data/db", "--enableMajorityReadConcern", "false" ]
volumes:
- <VOLUME-DIR>/mongo/data3/db:/data/db
- <VOLUME-DIR>/mongo/data3/configdb:/data/configdb