-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathdocker-compose.yml
51 lines (46 loc) · 1.21 KB
/
docker-compose.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
version: '3.6'
# Deploys MongoDB with customization scripts and container with Mongo client
# https://fabianlee.org/2018/05/20/docker-using-docker-compose-to-link-a-mongodb-server-and-client/
#
# usage:
# sudo docker-compose build
# sudo docker-compose up
services:
my-mongodb:
image: mongo:4.2.3-bionic
container_name: my-mongodb
ports:
- 27017:27017
environment:
- MONGO_INITDB_DATABASE=test
- MONGO_INITDB_ROOT_USERNAME=admin
- MONGO_INITDB_ROOT_PASSWORD=admin
volumes:
# seeding scripts
- ./mongo-entrypoint:/docker-entrypoint-initdb.d
# named volumes
- mongodb:/data/db
- mongoconfig:/data/configdb
networks:
- mongo_net
my-mongoclient:
# build will get tagged with 'image'
build: ./my-mongoclient
image: fabianlee/my-mongoclient:3.9
container_name: my-mongoclient
environment:
- MONGO_SERVER=my-mongodb
- MONGO_INITDB_DATABASE=test
- MONGO_INITDB_ROOT_USERNAME=admin
- MONGO_INITDB_ROOT_PASSWORD=admin
networks:
- mongo_net
depends_on:
- my-mongodb
volumes:
# default dir on Ubuntu: /var/lib/docker/volumes
mongodb:
mongoconfig:
networks:
mongo_net:
driver: bridge