Docker Container – A Silver Bullet for IT Industry
You might have heard word ‘Docker’ much frequently. All the noise is happening IT industries because most of the companies are adopting Docker technology at a noteworthy rate.
So what actually Docker is?
In a simple sentence, “Docker is an open source, container technology“
Using this technology you can easily create, deploy and run your Linux application in Docker container. Docker container allows developer or DevOps person to package up the application with all of the required dependencies and ship it as single package to customer/production site. By doing this, developer can be rest assured for any environmental or dependencies issues.
Docker technology is getting hotter in market as it has multiple advantages like –
- Docker containers are lightweight- Instead of hundreds or thousands of MBs, the container will only allocate the memory for the main process.
- Docker containers are fast- Docker container starts in few seconds.
- Docker containers are immutable- You can guarantee that the Docker image that was tested in QA environment will have same behaviour at the production environment.
Basically, a container is a tool which encapsulates discrete components of application logic along with only needed resource to do their job. Just to let you, Google also uses its own open-source, container technology lmctfy (Let Me Contain That For You). Whenever, you use any google functionality like Search, Gmail, Google Docs, whatever — then you’re issued a new container.
Docker technology is OS level virtualization, can also be referred as containerization, container based virtualization and application containerization. Containers are more efficient and cost effective. Docker has couple of vital components like-
Docker Engine – Store for containers. It manages containers using jobs.
Docker images – A Docker image is a read only blueprint containing information that will be used to create a Docker container.
Docker containers – A container is the runnable instance of the Docker image.
Docker registries – A Docker registry is a repository of images. Docker repositories can be public or private. Docker hub (https://hub.docker.com) is a public registry where you can search and download required images.
The advantage of using Docker is that it works on every platform which is available in the market. Frankly speaking, Docker is a suitable replacement for tools like hypervisors.
If you are going use Docker then, you need to take care of few things like –
- Don’t store data in containers. if you need to store data, do it in a volume( volume is just like symbolic link)
- Your application should be part of the Docker image. if you perform any code changes in application then you need to create new image and container in turn.
- Don’t run more than one processes in single Docker containers. You can, but it will be more trouble managing the processes individually.
- Don’t create large Docker images as it will be difficult to distribute
- Don’t run processes as a root useras it will be dangerous for others and may not be available in all environments. “By default Docker containers run as root.
- Don’t rely on container IP addresses as each container will have their own internal IP address and it could change if you start and stop the container.
Better than VM’s
You might have delivered your application with VMDK, OVF or OVA file format to customer so you may think that why to move from VM to Docker or why others are moving their applications from VM to containers.
Well, in a way, Docker is bit like a VM but, unlike a VM, rather than creating a whole virtual operating system, Docker allows application to use the same Linux kernel as the host machine. This increases the performance boost significantly and reduces the size of application.
Virtual machines have a full OS with its own memory management installed. Every guest OS VM runs as an individual entity from the host system using Hypervisor, an emulation layer between guest and host operating system. VMs are great at providing full process isolation for applications. A physical server running three virtual machines would have a hypervisor and three separate operating systems running on top of it.
On the other hand Docker containers are executed with the Docker engine. No hypervisor come in picture. A server running more than one containerized applications with Docker runs a single operating system. Each of these container shares the operating system kernel with the other containers in read only mode. Therefore containers are lighter and smaller than VMs in size. A container may be in MB in size however VM with its own OS may be several GB in size. Also, virtual machine take few minutes to start up its own operating system however, containers can be up in few seconds.
The main difference between containers and VMs is in their architectural approach as follow
Well, it’s not like that you should opt either for VM or container. Sometimes, VM and containers are better together. Docker Containers can run inside Virtual Machines though they are two separate technologies. In fact, I would say, containers in Virtual Machines are twice as robust as one without the other.
[Tweet “#Docker – A Silver Bullet for IT Industry ~ via @CalsoftInc”]