Running MongoDB in a Docker Container

Check Docker Version
docker volume create --name=mongodata
Volume is created for MongoDB.
docker run --name mongodb -v mongodata:/data/db -d -p 27017:27017 mongo
MongoDB image pulled from Docker Hub.
docker ps -a
Currently MongoDB image is running
docker exec -it 0f0 bash //replace 0f0 with your container id initials.
Executing the MongoDB image.
You will get the mongo version if you have successfully installed Mongo image.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store