Docker versus VMs

VMs and Dockers work in very different environments. Dockers are lightweight compared to VMs. The main difference between VMs and Docker is VMs provide hardware virtualization and Docker provides operating system virtualization. Let's observe VM's working in more detail. The following diagram describes the difference between VM and Docker internals in terms of layers:

VMs are the images of the operating system that run on top of the host operating system using hypervisor. VMs themselves have a full-fledged operating system bundled in image and required application on top of it. Any hardware request, even taking an input from the user via the keyboard, travels though a running application to the guest operating system call to hypervisor to the host operating system to hardware. A VM operating system doesn't call hardware directly. This causes a delay in response. One VM can be GBs in size. This can result in heavy loading at the start. If the number of VMs increases from one to three on the same machine, this could kill the speed. With an increasing number of VMs, the issue will be the increasing number of OSes running on the same host machine. As there is no provision in the VMs to share guest OS resources among VMs, every VM will be running its own guest OS, which will cost in terms of host machine resources.

Dockers, unlike VMs, share the host system kernel resources among all containers on that machine. In Docker systems, abstraction takes place at user space level. There is no separate kernel load, which results in less consumption in resources such as memory, CPU cycle, and so on. Starting up the full VM will take time in minutes, while Docker starts in seconds. The only limitation in container is it can't run completely different operating systems inside containers, which is possible in VMs. Complete isolation can be achieved in VMs only, but speed, high performance, and a shareable kernel can be achieved in Docker.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset