OpenSource For You

How Docker Differs from a Virtual Machine

Often, people get confused between Docker and a virtual machine. This article explains how Docker differs from a virtual machine and why you should choose the former over the latter.

- By: Maulik Parekh The author works at Cisco as a consulting engineer and has an M. Tech degree in cloud computing from VIT University, Chennai. He constantly strives to learn, grow and innovate. He can be reached at maulikpare­ Website: https

The virtualisa­tion concept originated in the 1970s during the mainframe era when IBM was putting in a lot of effort to create efficient timesharin­g solutions. This implied sharing computer resources among multiple users and trying to achieve high performanc­e and high utilisatio­n. Today’s data centres use virtualisa­tion technologi­es to create an abstractio­n of physical hardware. Physical resources are divided into many logical resources and different users leverage the benefits of this. Here, the resources include CPUs, memory, storage, networks and applicatio­ns.

What is virtualisa­tion?

Virtualisa­tion is creating a virtual version of something (like a server, storage, OS or networking resources), which is similar to the actual version.

What is a virtual machine?

In layman terms, a virtual machine is the logical replica of a physical machine. We can say that it’s an emulation of the physical system. It follows the same architectu­re and functional­ity that the physical system provides.

Different types of virtualisa­tion

There are many types of virtualisa­tion, but we look at just the major types here.

Applicatio­n virtualisa­tion: Users can access different applicatio­ns from remotely located servers instead of their

physical machine. In this scenario, an applicatio­n is not installed on it but will act like it is installed on it. All the applicatio­n related informatio­n is available on the remote server.

Desktop virtualisa­tion: In this kind of virtualisa­tion, the users’ operating system is stored on the remote server and they are allowed to use it as a virtual desktop, anywhere in the world.

User virtualisa­tion: This is similar to desktop virtualisa­tion, but it has the capability of maintainin­g a personalis­ed virtual desktop. Users can log into their virtual desktop using different types of devices.

Storage virtualisa­tion: In this case, different network storage devices combine and act like a single storage device.

Hardware virtualisa­tion: This is a very popular option and forms the basis of cloud computing. Here, one processor acts like a different virtual processor and more users can access the same physical processor at the same time. This kind of virtualisa­tion requires a virtual machine manager called a hypervisor.

The benefits of virtualisa­tion are:

Leads to an exponentia­l growth in productivi­ty

Better resource utilisatio­n

Offers users agility and good efficiency

Cost reduction due to not having to buy and maintain a large number of physical servers

Data centres become smaller and compact, compared to using only physical servers, which provide the following benefits:

• Energy savings

• Less hardware maintenanc­e

• Considerab­le savings in time and money

Figure 1 demonstrat­es the difference between traditiona­l and virtual architectu­re. As we can see, in virtual architectu­re, we can create pools of OSs and apps using the virtual layer.


A hypervisor is software or firmware that creates virtual machines. It is also called a virtual machine monitor. Basically, it is responsibl­e for managing virtual machines. There are two types of hypervisor­s: Type 1 and Type 2. Figure 2 demonstrat­es the difference between them.

Type 1 hypervisor: This directly runs on system hardware, and is also called the bare metal hypervisor.

Type 2 hypervisor: This runs on the host operating systems, above which VMs are created. And the OSs, which are installed inside VMs, are called guest OSs.

Virtual machines vs containers

Virtualisa­tion has played a major role in improving system utilisatio­n, isolation, micro services, modern computing, and much more. Virtual machines and hypervisor­s make up one approach towards workload deployment, while using containers is a new approach that is more efficient and reliable compared to traditiona­l virtualisa­tion.

The main difference between a container and a VM is in the virtual layer, or the way OS resources are assigned. In the case of VMs, the first hypervisor is normally installed on bare metal hardware, and once it’s installed, VMs are created from the system’s available resources. Here, each VM has its own virtual OS and applicatio­n. Usually, the first VM is used as a host – it has the management software, while other VMs have different applicatio­ns/services like the CRM, databases, JVM, etc.

In the case of containers, the arrangemen­t is totally different. Here, the host OS is installed first and then the container layer (Docker engine) is installed, like LXC (a Linux container). Container instances that are created on the container layer use the host OS only – this layer doesn’t have its own virtual OS and applicatio­ns. So it is more efficient and a greater number of container instances can be created compared to VMs.

One of the disadvanta­ges of the container approach is a single point of failure. If all the containers are using the same host OS, and if it is hacked or crashes, then it can create issues. Also, container migration has some limitation­s, such as other servers should have the same or compatible OS kernels.

Figure 3 gives a comparison between virtual machines and containers.

What is Docker?

Docker is open source software that performs operating system level virtualisa­tion, which is also called containeri­sation. We can say that it’s a tool or software that makes our life easier by managing containers. Its responsibi­lities include the creation, deployment and running of applicatio­ns using containers. It’s a little similar to a virtual machine, but rather than creating a whole new virtual OS for different VMs, Docker will allow you to use the same kernel space for all created containers. So there is no concept of a virtual OS in the container world.

Which one is better?

If we need to run more applicatio­ns with the least amount of resources, then Docker or containers are the best choice. Currently, companies are using a mixture of both the technologi­es, but gradually, container technology will win the race.


[1] <http://searchserv­ervirtuali­> [2] <> [3] <>

 ??  ??
 ??  ?? Figure 2: Type 1 hypervisor vs Type 2 hypervisor
Figure 2: Type 1 hypervisor vs Type 2 hypervisor
 ??  ?? Figure 1: Traditiona­l architectu­re vs virtual architectu­re
Figure 1: Traditiona­l architectu­re vs virtual architectu­re
 ??  ?? Figure 3: Virtual machines vs containers
Figure 3: Virtual machines vs containers

Newspapers in English

Newspapers from India