Skip to main content
  1. Posts/

Containers and VMs: What is the difference?

·544 words·3 mins
Chris Ayers
Author
Chris Ayers
I am a father, nerd, gamer, and speaker.

Containers are a very big topic right now, but they also cause a lot of confusion for people. Before we discuss containers, containerization, and container orchestration; we should address the question of how containers differ from virtual machines (VMs).

Both are built on the concept of Virtualization. Virtualization is the process of creating a virtual computing environment as opposed to a physical environment. Both technologies have their uses, and even today many solutions leverage both VMs and containers, sometimes leveraging VMs to host containers.

What are VMs?
#

A virtual machine (VM) is virtual infrastructure with its own virtual CPU, memory, network interface (NIC), and storage. A host machine runs VMs. The VMs that run on the host are called guests. The resources of the host are managed by a hypervisor.

The hypervisor is software that creates and runs VMs. The hypervisor gives each virtual machine the resources that have been allocated and manages the scheduling of VM resources against the physical resources. VMs are isolated from the rest of the system, and multiple VMs can exist on a single host. Because they are isolated, VMs can run different operating systems like Linux or Windows.

Workloads or applications running on a VM contain the entire operating system (Linux, Windows, …) as well as all the services, dependencies, and libraries needed to run and administer applications or workloads. Because VM images contain the entire operating system, they can range in size from hundred of megabytes up to several gigabytes. Starting a VM or application can also take several seconds to minutes

AdvantagesDisadvantages
VMs support diverse OS requirements for multiple applications on a single infrastructureVM image size results in longer backup or migration durations between platforms
VMs replicate comprehensive computing environments, easing portability and migration between on-premises and cloud platformsDuplicate copies of files (OS or libraries) are common among multiple VMs on a system
VMs provide superior isolation and security across systemsLimited VM support on a physical server compared to containers, due to full server encapsulation
A robust VM ecosystem and marketplace exists, featuring industry leadersVM start-up times can be lengthy, as the OS and kernel need to fully initialize

What are Containers?
#

Containers are lightweight, isolated, packages of software. The containers bundle libraries, configuration, scripts, and application binaries. There is a standard for containers images, The Open Container Initiative - OCI, for allowing interoperability of different container engines. Containers run on top of an OS and a Container Engine, like Docker, CRI-O, or LXD. The Container Engine pulls images from a container registry and runs applications.

AdvantagesDisadvantages
Containers are lightweight with images in megabytes, compared to VMs in gigabytesSteeper learning curve for containers
Containers offer high portability across on-premises and cloud environmentsContainers require a uniform OS, limiting OS diversity or version mixing
Reduced IT resources needed for container deployment, operation, and managementPotential security concerns due to shared OS in containers compared to VMs
Rapid container start-up times in secondsContainers are a newer technology with an evolving ecosystem

Next Steps
#

While VMs emulate entire machines, Containers are great for packaging applications and their dependencies. Next time we’ll look at the parts of a container image, how they are defined, and how they are run.

Related

Scripting Winget

·919 words·5 mins
When I reset my PC or setup a new test machine, I always have to download a lot of software. In the past, I’ve used Chocolatey, Boxstarter, or just installed everything by hand. I’ve played with winget, as part of the Windows Insider program. It was first announced in 2020 but was highlighted during Build 2021. With the release of Windows 11, I’ve setup machines a few times and wanted to automate the process using the new winget command.

DevOps - The Stakeholders

·385 words·2 mins
When I talk about DevOps, I usually don’t focus on the things like pipelines or automation. While these topics and activities can be part of DevOps, there is so much more to it. I’m sure this will be a multipart blog series so lets get started. The Definition # Let’s make sure we are all on the same page. The definition of DevOps that I love and subscribe to was coined by Donovan Brown at Microsoft.

How Do You Boil the Ocean?

·329 words·2 mins
This is a phrase I end up using a lot while talking with clients. I used to use a different phrase about elephants but moved away from that language to be more respectful. Let’s start with what it means, at least in the context I use it, and why this phrase is so useful when talking about Devops. The Meaning # I’ve seen and heard a few meanings and usages of the phrase, “Boil(ing) the Ocean”. I’ve heard many negative contexts like: to undertake an impossible task or project. I usually use it in this context, Here is a big task with lots to do, how do you get started and make progress?

Snake Oil DevOps - BEWARE!

·442 words·3 mins
As a DevOps Consultant a lot of what I do is spent on People and Processes. If you remember the definition of DevOps that I love is from Donovan Brown, “DevOps is the union of People, Processes, and Products to continuously deliver value to our end users”. I want to keep reiterating this, continuously deliver value to our end users. I bring this up because my job as a DevOps Consultant is to delivering value to my end users. But not all of us do. My amazing coworker (@_s_hari) and I have discussions about this quite a bit. As far as I know, he coined the term and gave me his blessing to blog about it.

What is DevOps?

·230 words·2 mins
What Isn’t DevOps? # Before I define DevOps, let’s get started with what DevOps isn’t. DevOps isn’t just a title, or a guy, or a department. DevOps isn’t just automating everying, and isn’t just logging everything. DevOps isn’t dozens of alerts every day, and isn’t an on-call rotation. DevOps isn’t agile or small releases. DevOps is a mindset.