Docker vs Virtual machine
Let’s take a quick view of what these docker and virtual machines are.
What is a virtual machine?
Virtual machine is a virtual computer which runs applications separately. Okay let’s take an example and understand what those latin words say.
Above example shows a quick overview of the virtual machine. In our machine we can virtually install many computers as possible as given in the example. In a virtual machine it has its own operating system and applications.
Virtual machines need hypervisor
Hypervisor is the component which allow the virtual machine to access the hardware and software of the host operating system. Without hypervisor it cannot do anything.There are two types of hypervisors,
- Type 1 hypervisor
This hypervisor allow the virtual machine to access the computer hardware by hardware virtualising.
- Type 2 hypervisor
This hypervisor allow the virtual machine to access the system resources using the host operating system.
What are the advantages of Virtual machine
- Cost reduces as it allows to run multiple operating systems in a one machine
- Highly scalable as resource can be added and removed easily
- Security increases as they run in isolation
Above are the main advantages and there are many more.
What are the disadvantages of Virtual Machine
- Resource consuming as we have to allocate some resources to it
- Heavy since the whole operating system is running
- Not portable as we cannot move the virtual machine one place to another.
What is Docker?
Docker is a container and let’s take an example and understand what docker is.
In Docker what it does is it virtualise the operating system. How it does is in the docker engine there is a linux operating system operating and those containers share that operating system. Then as you see in the example above there are no separate operating systems for each and every container and what it has is only the required libraries and dependencies. Then those are lightweight.
Those containers can be create using specifying the libraries and dependencies on it. Then those can be move one machine to other facilitating the portability. Then if the application run on my machine definitely run on your machine because of this portability.
What are the advantages of Docker
- Lightweight because it has only the required libraries and applications only
- Portable because the once image is created it can be move and run in anywhere. ( images are use to create containers )
- High efficiency
- Highly scalable
- Extremely fast in booting up
What are the disadvantages of Docker
- It require a docker on every machine operating
Above is the main disadvantage of docker
As you see docker is more lightweight, portable, fast than virtual machines.
If you have found this helpful please hit that 👏 and share it on social media :)