This article is intended to introduce you two different topics Docker and MongoDB and how MongoDB can be added as a Docker container on Docker so that the installation of MongoDB can be done on any system with much ease. One thing to notice is that we are not performing this installation on a Windows machine, as Windows support for Docker is still in the budding stage and hence to save loads of time continued with Linux.
With no further delay, let us know understand the semantics of Docker and MongoDB and then we will look into the process of creation of Docker Container in Docker.
What is Docker?
Docker is a leading software container platform which helps developers to run and manage applications side by side in isolated containers for getting better compute density. In simple words, docker will automate the repetitive mundane tasks of setting up of the development machines / environments with the necessary configuration, so that the developers can work on the tedious job of creating better applications.
What is a Docker Container?
A Docker container can be understood as a light-weight, stand-alone, executable package of software which includes all that is needed to run / execute it. Docker container’s main goal is to isolate software from its surroundings like for example the differences between development and staging environments running different softwares on same infrastructure. A Docker container can be best understood as a virtual machine minus the operating system that comes along with a virtual machine.
How to create a MongoDB Docker Container?
Before creating a docker image of MongoDB, it is very important for us to understand the how we configure our docker image file. What details are required the most to have this achieved? I’m going to walk you through each step on how this can be achieved, starting with docker image configuration file.
For creating the docker image, we are going to use a Fedora 20 instance with docker-io package pre-installed. The docker instance is enabled and the docker service is UP and Running. Username has already been added to the docker group under /etc/group just so that we don’t have to issue sudo docker commands.