Docker - MongoDB Up and Running in Minutes
Today, I will show steps to pull a MongoDB docker image and locally running a Mongo database server. I have explained in Docker post the basics and how to configure and run MySQL.
Pulling the image
Once you identified the image , you can bring it to your local machine by issuing the pull
.
Starting the MongoDB server
It is good to mount a local drive at /data/db
, that way DB is available even after server restarts.
If the server is successfully started, you could see the process information by running the ps
command. In my case it shows 2ee14feaa563
is the container ID and it is running for the past 6 seconds.
Connecting to MongoDB server
I use RoboMongo client to interact with MongoDB. Alternately I can connect using mongo shell as shown below:
The output of a successful connection looks like below:
Conclusion
I did the MongoDB for DBA course long time back, having a local mongodb server always help me to brush up my knowledge. Sometime soon I will be doing a post comparing SQL and NoSQL syntaxes.