The virtual machines versus containers debate is now ancient history. Around 2015, these two technologies were pitted against one another. Enthusiasts were camped at opposing sides, and then something happened. The battle swiftly ended with the realization that they were complementary.
The better question now is how can VMs and containers best work together?
VMs vs. containers?
When virtual machine technology became widely available in the late 1990s, it led to a revolution in business computing. Hypervisor-based virtualization of servers provided a new ability to consolidate workloads on physical hardware, improving utilization.
The arrival of practical containerization, lead by Docker, is sparking a similar revolution. A container encapsulates an application instead of an entire server, so it’s much lighter weight than a VM, only including the particular resources required by the app. Besides enhancing efficiency, performance, and agility, containerized applications are a boon to the development process because they are easy to set up, quick to start, and quick to redeploy.
Containerization also pairs naturally with microservice architectures. Scalability is enhanced. You can rapidly deploy exactly the number and types of containers needed. Maintainability also is improved, you only need to update the affected containers. Practical containerization is still fairly new, and it will be some years before the full impact on business computing is known.
Containers are an alternate way to virtualize. They abstract workloads from the underlying hardware in a different way than traditional VMs. Containers running on real hardware are more resource-efficient than containers running on VMs, which incurs the cost of an additional level of virtualization.
Established organizations often have a considerable investment in VM-hosted applications, the infrastructure required to run VMs, and the management tooling to support it all. On top of all that is the investment in developing expertise and procedures to use VMs successfully. Adding containers into that mix means additional complexity and issues for IT.
Within the developer team, the low startup overhead, rapid reconfigurability, and simple portability of containers is a win. To the ops team, containers lack the mature management infrastructure that supports familiar VM-hosted applications.
But with the right approach, both technologies can mesh well and help drive more successful business outcomes.
Why they are a perfect match
A VM virtualizes below the OS, providing a virtual server for the entire software stack. A container virtualizes above the OS, providing a virtual userspace for an application and the resources it depends on.
VMs are heavier weight but less dependent on underlying software. This means better isolation (and thus better defense against some security threats) and more portability (being dependent only on the hypervisor, not on other system software).
Containers, lightweight and agile, can easily be the workload running on a VM that provides security, portability, and familiar manageability.
Application mix. How you mix and match VMs and containers is shaped by your application mix. Monolithic legacy applications, particularly those with long running times and persistent data, will still best run in a VM – particularly when VMs already tailored for them exist. Apps which require a customized OS kernel are also naturals for a VM.
New apps, designed to be cloud-native with microservice architectures, are clear fits for containers, particularly when they have short-term execution lifespans and are highly elastic.
Established apps which are being refactored for the cloud into a microservice-style architecture, or evolved to integrate with cloud-native apps, will span both options. Over time, for many organizations it’s likely a larger proportion of the workloads will become containerized, but traditional VMs will not go away.
Integration options. How do you integrate VMs with containers? The key questions include:
- How do I host and manage containerized applications alongside my VMs?
- How do I get them to cooperate effectively?
Multiple vendors are developing facilities to help, while several are experimenting with new ideas for converging or hybridizing the two. For organizations invested in VMs, if your virtualization infrastructure vendor has added support for containers, you may have multiple options.
One option is to use individual VMs to host individual containers, particularly with lighter-weight VMs customized for containers. IT can then use familiar virtualization management tools, with extensions for container management; and the VM will address security and portability concerns of containerization. VMware vSphere Integrated Containers and Microsoft Azure Stack offer this option.
Alternately, running multiple containers inside a host VM improves utilization and efficiency, while sacrificing some isolation. A pool of VMs can support a dynamic mix of containers, efficiently distributed by an orchestration system like Kubernetes. VPS systems and cloud providers like VMware, Azure, and AWS are integrating container-oriented orchestration and clustering systems like Kubernetes into their virtualization management offerings.
Many companies are actively evolving virtualization management tooling, as well as innovating in the convergence and hybridization of the virtualization systems themselves.
VM and container management tools. Administrators have had access to production-quality tooling from VMware, Microsoft, AWS, and others, for configuring and managing VMs to achieve high availability, scalability, and security, tune resources, migrate loads, and perform troubleshooting. Containers add new needs to the mix, such as managing microservices.
Systems designed to manage containers are maturing. Docker manages containers on bare-metal quite well but does not yet provide all the facilities organizations want, and are familiar with. Thus several providers are integrating clustering and orchestration facilities like Kubernetes into their virtualization management systems. This lets you use your existing infrastructure to host a mix of VMs and containers and treat the containers as first-class citizens.
VMs becoming better hosts for containers. Hypervisor vendors like Intel and Microsoft are evolving customized virtualization layers that are optimized container hosts. Similarly, OS vendors are creating versions optimized for containers.
Containers gaining nontraditional capabilities. Containers are gaining abilities that previously were restricted to VMs, such as live migration and low-level access to hardware.
Unification alternatives. Multiple organizations are exploring innovative ways to unify VMs and containers. These include developing mechanisms to run an app designed for a VM inside a container or making a lighter-weight VM mimic a container, or wrapping a VM in a Kubernetes pod so it can be managed as a collection of containers.
Container appliances. Some vendors are developing hyper-converged appliances optimized for containerized applications, or for a mix of containers and VMs.
The relationship going forward
VMs and containers offer virtualization at different levels and have complementary strengths. Light-weight agile containers and heavier-weight, more independent VMs can be mixed and matched to give you a great range of possibilities for your applications. Systems to support mixed environments are improving, and vendors are actively exploring innovative ways to converge and hybridize your virtualization options.
When VMs became widely practical, few would have predicted the sea change of IaaS and the cloud. Similarly, the true effects of containers are only starting to appear. The coexistence of VMs and containers will affect both. The way VMs and containers interact will morph, and the long-term effects of wider options for virtualization, are just coming into focus.