The Deep Dive
Explore the fundamental differences between containers and virtual machines to understand how Docker uses OS virtualization. Learn how containers offer improved portabilty, faster startup, reduced resource usage, and enhanced security features compared to VMs. This lesson helps you grasp why containers are more efficient for deploying applications in modern IT environments.
We'll cover the following...
Containers vs. VMs
Containers and VMs are both virtualization technologies for running applications. They both work on our laptops, bare metal servers, in the cloud, and more. However, the ways they virtualize are very different:
VMs virtualize hardware.
Containers virtualize operating systems.
In the VM model, we power on a server, and a hypervisor boots. When the hypervisor boots, it claims all hardware resources such as CPU, RAM, storage, and network adapters. To deploy an app, we ask the hypervisor to create a virtual machine. It does this by carving up the hardware resources into virtual versions, such as virtual CPUs and Virtual RAM, and packaging them into a VM that looks exactly like a physical server. Once we have the VM, we install an OS and then an app.
In the container ...