Difference between Docker and Virtual Machines ?

Difference between Docker and Virtual Machines ?

After the current Docker boom in the IT/DevOps world... I am being asked many times that what’s the difference between Docker and Virtual Machine?

So, I decided to write the small blog and let’s understand the clear difference between 2 different technologies.

What is Virtual Machine?

Nothing, but the complete OS running inside Virtualization/Hypervisor softwares like VMware/ VMware ESXI, OpenStack and VirtualBox.

As above diagram illustrates, on top of your bare metal hardware (server) you have to install first the host operating system and then Hypervisor (type2) softwares for example VMware and VirtualBox.

After installing them, you are now ready to launch VM machines on top of it..

So, for example if you have webapp which needs 1 Webserver 1 Database 1 Application server so you will end creating 3 VMs on hypervisor. 

Ufff ... so now hardware capability of the server is now finished and you cannot create more VMs on it. You will have to purchase another server if you need to scale up your app.

So now how Docker is different from Virtual Machine?

Completely different, Docker containers wrap a piece of software in a complete filesystem that contains everything needed to run: code, runtime, system tools, system libraries – anything that can be installed on a server. This guarantees that the software will always run the same, regardless of its environment.

As above diagram illustrates, over the bare metal server (Infra) there is Host Operating System and inside OS, there is daemon of Docker engine which lets you run 100s of containers (obviously depends on hardware specs) instead of full VM operating systems.

This feature of docker makes the scaling of your app very flexible .. as resources are being shared between containers and it does not get wasted among Guest OS as in virtualized environment.

Above is the primary advantage of using docker, but lets discover more advantages.

  1. Docker allows for portability across machines. The application and all its dependencies can be bundled into a single container that is independent of the host version of Linux kernel, platform distribution, or deployment model. This container can be transferred to another machine that runs Docker and executed there without compatibility issues.
  2. Docker allows for sharing. You can use a remote repository to share your container with others.

When to use what?

There are pros and cons for each type of virtualized system. If you want full isolation with guaranteed resources, a full VM is the way to go. If you just want to isolate processes from each other and want to run a ton of them on a reasonably sized host, then Docker is your great friend.

learn more about Docker ?

https://www.docker.com/what-docker

Above blog is inspired from below links:

https://www.jpkeisala.com/difference-virtual-machine-docker/

https://www.cynexlink.com/2017/08/18/virtual-machines-pros-cons/

https://www.trustradius.com/reviews/docker-2017-08-03-10-32-21


We've been using a docker for a while now but it's just now that I start the understand its difference from VM. Nice reading :)

Like
Reply
Rajesh Kumar Barnwal

Oracle Database Architect, Cloud Migrations, Database Security, OEM Expert, ExaCC, Golden Gate Specialist at Cognizant Technology Solutions

6y

Thank you Aziz for seeding the docker worm in my mind... :) !!!

Like
Reply

Great valuable

Like
Reply
Ronald Pacheco

Senior Director Linux Business & Ecosystem Strategy

6y
Matthieu BILLAUX

⚔️ Red Team Tech Lead | HackTheBox 🇫🇷 Ambassador 💚

6y

Great article Aziz

To view or add a comment, sign in

Insights from the community

Others also viewed

Explore topics