alphaspirit - Fotolia


Containers vs. VMs: Which should you use for cloud?

Before going all in with containers, it's critical to understand how the technology differs from VMs in terms of private, public and hybrid cloud deployment.

The majority cloud deployments today are based on virtual machines, but it's become clear that containers offer significant benefits to cloud users. However, before choosing one technology over the other, it's important to understand the key differences between containers vs. VMs. The big question is whether VMs or containers are best suited for public, private or hybrid cloud strategies. And the answer depends on three primary factors: the functional differences between VMs and containers, the level of interdependence between private and public cloud components, and users' willingness to customize their own cloud platform.

Containers vs. VMs: Understanding the difference

VMs and containers represent two different ways to create virtual resources that run applications. With VMs, a special software system -- a hypervisor -- partitions a server below the operating system (OS) level creating true "virtual machines" that share only hardware. With containers, virtualization takes place at the operating system level, so the OS and possibly some middleware are shared.

Functionally, VMs are more flexible, because the "guest" environment where applications run is similar to a bare-metal server. You can pick your own operating system and middleware, independent of what other VMs on the same server might use. With containers, however, you need to accommodate a common OS and middleware elements when you choose applications, since each container uses the core server platform and shares it with other containers.

For enterprises with a variety of software platforms for their applications, containers may be more difficult to use because of the need to standardize on a single hosting platform. Even when everything runs on a single OS, you may need to harmonize everything to use a single version of some or all middleware tools -- which can be difficult to do if software is dependent on a specific version.

On the other hand, containers have less overhead because they don't duplicate the platform software for every application or component that's deployed. This lower overhead makes it possible to run more components per server with container technology. In addition, the deployment and redeployment of applications or components is faster with containers.

Because containers are usually deployed through management platforms like Docker, it's also generally easier to operationalize container-based clouds than VM-based clouds, where management tools are more varied.

Choosing containers vs. VMs for public, private or hybrid cloud

Users can gain all the benefits of containers in private cloud deployments. And for businesses with standardized operating systems and middleware, container-based private clouds are likely the best strategy. However, for public and hybrid clouds, containers are often more problematic and VMs may be the better approach.

For enterprises with a variety of software platforms for their applications, containers may be more difficult to use because of the need to standardize on a single hosting platform.

For example, one challenge for enterprises adopting containers is that container hosting services in the public cloud are more difficult to find than VM services. While some infrastructure as a service (IaaS) providers, such as Amazon Web Services, offer container services, these services are normally an overlay to the IaaS service, and, in many cases, are only available for customers using a dedicated server or cluster hosting. While any user can deploy VMs via a public IaaS service, it is more complicated with containers, in terms of setup and operations -- particularly because container networking may be difficult to accommodate inside a public cloud.

The difficulty of deploying and managing containers in a public cloud can also make container deployments more complicated in hybrid clouds. , best practices for container deployment an application suggest co-hosting all its components for easy network connection. This, however, makes it more difficult to manage cloud bursting or to failover to public cloud resources -- which are two the most common hybrid cloud use cases.

Second, any differences in middleware or OS at the application level will limit container deployment in the cloud if the cloud container platform isn't compatible. That means hybridization might not work the same across all applications.

Hybrid clouds based on containers are easier to build and maintain if the component distribution in the cloud versus the data center is fairly constant, or if an organization cloudsources those components in a very structured way -- for example, from a specific set data center servers to a specific set cloud servers. This makes the networking and integration the hybrid environment easier to manage and less prone to configuration errors. With VMs, however, it's generally easier to deploy applications and components into the cloud from the data center using standardized tools and integration practices.

Easing into container technology

It's best to gain familiarity with container technology in private deployments before moving to the public cloud. Knowledge how containers work, and what's needed to maintain them in operations, will help you select the right approach, tools and providers. Container management tools like Docker or Cloud Foundry are essential to make containers work, so try them out in house and decide what's best for you.

In the long term, it's likely that management tools will deploy VM- and container-based clouds. As these tools evolve, the operational differences between container- and VM-based clouds will shrink, and the primary difference will be related to security and compliance. If you're making a choice now, make sure containers offer enough isolation for your cloud applications, since the security and compliance differences between containers vs. VMs is unlikely to shrink over time.

Next Steps

Three application types that thrive in Docker containers

Five drawbacks using container technology

Exploring the relationship between containers and cloud

Dive further into the containers vs. VM debate

Important terminology for cloud containers

Dig Deeper on Cloud deployment and architecture

Data Center