web:
build: .
command: python3 /app/app/__init__.py
ports:
- "5000:5000"
volumes:
- .:/app
links:
- db
db:
image: mongo:3.6.5
ports:
- "27017:27017"
command: mongod --smallfiles --logpath=/dev/null # --quiet
This is my docker-compose.yml
. I have a database dump in this same folder which is a collection of json
and bson
files. I want to avoid doing mongorestore again and again and want my flask app to take data from the dump directly as soon as I do docker-compose
up.
Use this:
volumes:
- '/home/sa/data/db:/data/db'
/home/sa/data/db
is dump files folder on host
/data/db
is a folder in docker container.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.