Are containers better than virtual machines (VMs)? The question may seem barely worth asking, since containers and VMs look the same on the surface. Yet, a deeper dive into this issue highlights just how different containers and VMs are.
Today, deciding whether to migrate from traditional virtual machines—by which I mean ones that run on hypervisors such as VMware, Microsoft Hyper-V or KVM—is a major task for many enterprises. It’s also one whose urgency may not be obvious.
After all, containers and VMs both essentially do the same thing: They let you run software inside a virtual environment. So why worry about choosing between one or the other solution, especially if you’re already running virtual machines and they work for you?
Containers vs. Virtual Machines: What’s Different
Well, there are lots of reasons. Consider the following major differences between containers and virtual machines:
- Containers have less overhead. At best, you could run maybe 50 VMs on top of a single physical host—and you’d need a pretty powerful server to get to even that number. But because containers have less overhead, you could run hundreds on top of a single host.
- Containers are easier to work with. One of the coolest things about Docker containers is the way you can pull and run a container image in a few seconds. You could also download and set up a VM image from the internet, but that process is not as streamlined.
- Containers are more standardized. There are multiple VM platforms out there, each with its own way of doing things. Being an expert in, say, VMware doesn’t necessarily qualify you to work with KVM, too. But with containers, Docker’s dominance and the Open Container Initiative have helped to standardize the entire container stack. There’s less nuance to have to learn.
- Containers are more open. Some VM platforms, such as KVM, are open source. But most are commercial products, which are only partially or not at all open. In contrast, platforms such as Docker are completely open source. That makes containers the better choice if you’re worried about vendor lock-in—or if you just believe that open source is a better way to do things all around.
This doesn’t mean containers are always better than VMs, of course. In some situations, VMs are still a better choice. But overall, containers have a lot of good selling points, which make them a more attractive solution for virtualizing software than traditional VMs. That’s worth keeping in mind as more organizations re-evaluate their virtual infrastructure strategies.