Docker Tutorial – The Differences Between Containers vs Virtual Machine

The Differences Between Containers vs Virtual Machines

Welcome to the first part of Docker Tutorial. This is the introduction part of Docker Containers. On this article, we are going to learn more about the differences between Containers vs Virtual Machines. You may hear about the virtual machine, VMware Workstation or Virtualbox. VMWare and Virtualbox are the most popular virtualization software you may know. In the other side, Docker Containers technology was born after those two virtualization giants. Containers are changing the way we develop, run and also distribute software.

With the Containers technology, the developers can focus on building the software locally, and knowing that their software will run on any environments. No matter it will run on an end user’s laptop, in the cloud or inside a company server rack. 

Containers are an encapsulation of a software including its dependencies. With all the dependency and supporting files included, we can run the software anywhere regardless of the host system. At first glance, Containers is just like a lightweight form of Virtual Machine (VM). Like a VM, the Containers comes with an isolated operating system to run the application.

The Key Features of Containers

  • The Containers share resources with the host. This makes them more efficient in term of resource usage. 
  • Containers’ portability has the potential to eliminate bugs caused by changes in the running environment. 
  • The lightweight nature of containers will enable the developers to run many containers at the same time.

The fundamental goals of VMs and Containers are slightly different. The VMs emulate the whole foreign environment on the host while the Containers purpose is to make the application more portable and self-contained.

Containers vs Virtual Machines

You may think that Containers and Virtual Machines are similar. Well, first it is. But there are some fundamental differences that we will discuss below. The following figure describes how three different applications run on separate VMs on a single host. 

Using Docker: Developing and Deploying Software with Containers (Adrian Mouat)

As you can see from the illustration above, the hypervisor controls the VMs. Each VMs requires a complete operating system. Now compare with the second image showing how Containers work on a real machine. 

The following image showing how three different applications run on a containerized system. In the container scheme, the host shares its kernel with the running containers. This means, the applications always connected or constrained with the host. As you can see, App Y and Z share the same libraries. The Container Engine is responsible to start and stop the containers, similar with the Hypervisor. 

The Differences Between Containers vs Virtual Machines
Containers running on a single host.

Containers are more lightweight compared to Virtual Machines. Virtual Machines require a full OS installation, need more resources and time to maintain, patch and update the operating system. While in the Containers environment, the patch and updates are way easier. Learn more about Docker.

Thanks for reading The Differences Between Containers vs Virtual Machines. Please share this article if you think its useful to you.

Be the first to comment

Leave a Reply