-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
60 lines (58 loc) · 1.37 KB
/
docker-compose.yml
File metadata and controls
60 lines (58 loc) · 1.37 KB
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
version: '3.4'
services:
database.service:
image: ${DOCKER_REGISTRY-}databaseservice
container_name: database-service
hostname: database-service
build:
context: .
dockerfile: Dockerfile
depends_on:
- database
ports:
- 443:443
networks:
- database-network
database:
image: mongo:latest
container_name: database
hostname: database
expose:
- "27017"
ports:
- 27017:27017
networks:
- database-network
volumes:
- ~/mongodb/data:/data/db
restart: always
entrypoint: /usr/bin/mongod --bind_ip_all --wiredTigerCacheSizeGB 0.25 #--replSet rstest
# mongosetup:
# image: mongo:latest
# container_name: mongosetup
# hostname: mongosetup
# depends_on:
# - database
# networks:
# - database-network
# restart: "no"
# command: >
# mongosh --host database:27017 --eval
# '
# config = {
# "_id" : "rstest",
# "version": 1,
# "members" : [
# {
# "_id" : 1,
# "host" : "database:27017"
# }
# ]
# };
# rs.initiate(config);
# '
networks:
database-network:
driver: bridge
#https://www.mongodb.com/docs/drivers/go/current/fundamentals/connection/#connect-to-a-replica-set
#mongodb://localhost:27017/?replicaSet=rstest&directConnection=true