top of page

Docker Containers vs Virtual Machines

Note : Docker Containers are not Virtual Machines

What is a Virtual Machine ?

Let's explain each layer from the bottom

  • Everything starts with INFRASTRUCTURE. This could be a laptop , a dedicated server running in a datacenter or a server being used on AWS or Google Cloud

  • On top of it runs an operating System ( Windows or Distribution of Linux or a Mac OS ) , if it is a VM then it would be commonly labelled as a Host Operating System

  • Then comes your Hypervisor. There are two types of hypervisors

  • ​Type 1 Hypervisors which runs directly on the system hardware

  • Type 2 Hypervisor run on a host operating system that provides virtualization services

  • Post Hypervisor , comes our Guest OS. For example , if we have to spin up three applications then we need to have

  • Three Guest OS virtual machines controlled by our Hypervisor

  • Each Guest OS has Memory / Storage & CPU OverHead to it for it to run

  • On top of these we will need to have binaries on each Guest OS to support the application

  • Finally , you would have your application installed. If one want's these applications to be isolated , then these have to installed on separate virtual machines

What is a Docker Container ?

Looking at the above image you would see a striking difference. Yes, There is no need to run a massive guest operating system.

Let's break it down again from bottom to top approach

  • Docker containers do need INFRASTRUCTURE to run them. This could be laptop , a virtual machine running on a datacenter or a server running on AWS or Google Cloud

  • Then comes HOST OPERATING SYSTEM. This can be anything capable of running Docker. All Major distributions of Linux run Dockers. There are ways to install Dockers on Windows and MAC OS as well

  • In the next phase, as you can see DOCKER DAEMON replaces HYPERVISOR. Docker Daemon is a service that runs in the background on your host operating system and manages everything required to run and interact with Docker containers

  • Next up we have our binaries and libraries, just like we do on virtual machines. Instead of then being ran on a guest operating system, they get built into a special packages called Docker Images. Then the Docker Daemon runs those images

  • The last block in this building is our applications.Each applications ends up running in it's own Docker Image and will be managed independently by Docker Daemon.Typically each application and it's library dependencies get packed into the same Docker Image. As shows in the image , applications are still isolated

Real World Differences between both Technologies

  • There's a lot less moving parts with Docker. No need of a Hypervisor or a Virtual Machine

  • Docker daemon communicates directly with the host operating system and knows how to distribute resources for running docker containers. It's also an expert at ensuring each container is isolated from both the host OS and other containers

  • If you want to start an application running on a virtual machine , you would have to wait till the operating system boots up. This eventually takes a minute or two. But in Docker container it just takes milliseconds

  • You would save on Storage, Memory and CPU as there is no need to run a lousy and bulky Guest OS for each application you run

  • There's also no virtualization needed with Docker since it runs directly on the host OS

Both Technologies are good at what they do the best

  • Virtual Machines are very good at isolating system resources and entire working environments

  • Docker's philosophy is to isolate individual applications , not entire systems

!!! Stay Tuned for more on Dockers !!!

74 views0 comments

Recent Posts

See All
bottom of page