DEV Community

loading...
Cover image for The mongo docker volume

The mongo docker volume

Visakh Vijayan
Willing to learn anything and everything exciting. Always awake. Skips food for fun.
・1 min read

I wanted to load the production with fixture data from my local database. One of the possible solutions was copying to the volume from the local database and then restoring it in the production one.

Alt Text

The line under volumes copies the files in the dbdump to the docker-entrypoint-initdb.d

docker-entrypoint-initdb.d is a default folder created under the mongo volumes.

Then in the production one, you can communicate with a container using the exec -it command as mentioned here and do a mongorestore

Hope this helps!

Discussion (0)