Table of contents
No headings in the article.
The virtualization of physical hardware resources has been one of the most promising trends of the 21st century. Virtualization brings several advantages such as resource efficiency, low cost, etc. to name a few. There are 2 main methods of virtualization, those being Virtual Machine (VM) and Docker. Docker is more in use than virtual machines and has more uses than virtual machines but this does not mean Virtual Machines are in any way inferior today. In this blog, I try to explain what Docker and Virtual Machines are and their importance and how they revolutionized the industry.
What are Virtual Machines?
A virtual machine is a form of virtualization that uses the operating system's resources to run another Operating System (OS). VM in today's world is used to perform tasks that if performed directly on the host machine may prove to be risky. VMs are isolated from the rest of the OS. The software running within the VM cannot interfere with the Main OS. VM nowadays are used to access virus-infected files and are used for testing cyber security practices, if something is infected only the VM would be affected but not the main system.
Virtualization Defined For Those who are more Visually Inclined
Here are some of the pros and cons of Virtual Machines
Pros:
- It lowers hardware costs. A person or organization does not need to invest in other hardware resources. Instead, they can use virtualization.
- Another advantage is that it has a smaller footprint. By utilizing virtualization, companies can reduce the space that hardware occupies.
- It increases data security. VMs are isolated from the main system. Many Cyber security companies employ the use of VMs to test their antivirus/cyber security applications.
Cons:
- It can only use the resources allocated to it by the system. If more than one VMs is running it can slow the system down to a halt.
- It has a slow boot-up time.
- It is not very efficient. It cannot access the hardware directly.
- While a properly-structured VM can't infect a host, a weak host system can infect its VMs. This usually happens when there are bugs in the operating system. If two or more virtual machines are connected with each other, the infections could spread to others as well.
VMs cause more problems than they solve. That was what people had to deal with before Docker came into being.
What are Containers?
To understand what the importance of Docker is, one must know what a container is.
Architecture of a Container
Containers can be described as creating virtualization of the operating system. Containers unlike Virtual Machines are lightweight and portable and do not take as much of the system's resources as a VM does. Here are the Pros and Cons of Containers.
Pros:
- Containers require fewer system resources than VMs because they don't include operating system images.
- They are very portable. Applications running in containers can be easily deployed to different OS and hardware platforms.
- They are more efficient. They can be rapidly deployed, patched or scaled.
- Containers simplify the build/test/deploy pipelines in DevOps.
- DevOps teams know that the applications made in containers will work the same, regardless of where they are deployed.
Cons:
- Not all applications benefit from containers.
- It cannot run applications as fast as bare-metal rates.
- The container ecosystem is split But the core Docker platform is open source, and some container products don't work with other ones.
- Graphical applications do not operate well.
In the image detailed below, you can see the difference between a VM and a container.
Virtual Machine architecture vs Container architecture
What is Docker?
Docker is an open-source tool that uses containers to create, deploy, and manage distributed applications. Docker was created by Solomon Hykes. Mr. Hykes first showed off Docker at PyCon in March 2013. Docker began getting traction when its version 1.0 was released in June 2014 and has achieved critically-acclaimed status. Many organizations now opt to use Docker over VMs because of the performance benefits that it offers. Companies like Visa and Paypal now use Docker to manage their applications.
A misconception among many people is that Docker created the concept of containers but that is wrong Docker only brought it to critically acclaimed status as stated before. Containers existed very well before Docker. The concept of container can be traced back to 1979 with the development of chroot.Chroot marked the beginning of container-style process isolation by restricting an application's file access to a specific directory the root and its children.When Docker was launched it used Linux Containers (LCX) as its default execution environment. Down below you can see the history or should I say the evolution of containers.
Which one to Use and When:
While Docker has advantages in efficiency and performance that does not mean that in every situation Docker would be a better option than VMs. The two technologies/applications have their own pros and cons, and due to that they are useful in certain situations where the other won't be very helpful. The usage of the applications depends on the size and the type of the application. Here are some tips on which one should you use depending on these two factors.
Size:
One of the factors for consideration is the size of the application. The amount of computing resources that the application requires will determine the choice. For high priority services such as Malware Testing, databases the natural choices would be VM but if it is of low priority and requires only one machine like micro services then you should use Docker.
Application Type:
Another factor would be the type of the application you wish to deploy. If the application is not related to the host's OS then a Docker container would be useful as Docker containers will work the same, regardless of where they are deployed. But if it requires the host's OS then VM will be better suited for your needs.
This clears up the difference between Docker and Virtual Machines. What are their pros and cons are. How they are being used in the industry and the situation in which the tool/technology is used.
References:
Virtualization Guide - Elipse Software. - Elipse Knowledgebase
Containerization: A Definition and Best Practices Guide - Plutora.com