How to create a Mongo Docker Image with default collections and data?
The problem was that information could not be saved on /db/data, so I’ve created a solution creating my own data directory. # Parent Dockerfile https://github.com/docker-library/mongo/blob/982328582c74dd2f0a9c8c77b84006f291f974c3/3.0/Dockerfile FROM mongo:latest # Modify child mongo to use /data/db2 as dbpath (because /data/db wont persist the build) RUN mkdir -p /data/db2 \ && echo “dbpath = /data/db2” > /etc/mongodb.conf \ … Read more