How to mount folder that contains db data ( file system ) outside docker container, so that if somehow docker container is stopped we can persist data ( get back the data ) on restarting the docker container ?
/data/db when all data gets dumpeddocker volume create <VOLUME_NAME>
# docker volume create mongo_db_data
/data/db of mongo container to volume here mongo_db_datadocker run -p 27017:27017 -v mongo_db_data:/data/db mongo
docker volume ls # List all existing volume
Q Why we should never mount multiple mongo db container to same volume ?
It will create concurrency issues. Overwriting file system

const mongoUrl: string = `mongodb://localhost:27017/myDatabase`;
// If we start node js process on a docker container by running
docker run -p 3000:3000 node-app
// "localhost" would mean localhost of node-app container, and no process is running on localhost:27017 of node-app container