Updated: Mar 15, 2021
Containers are a form of operating system virtualization. A single container might be used to run anything from a small microservice or software process to a larger application. Inside a container are all the necessary executables, binary code, libraries, and configuration files.
Compared to server or machine virtualization approaches, however, containers do not contain operating system images. This makes them more lightweight and portable, with significantly less overhead.
In larger application deployments, multiple containers may be deployed as one or more container clusters. Such clusters might be managed by a container orchestrator such as Kubernetes.
Benefits of containers
Containers are a streamlined way to build, test, deploy, and redeploy applications on multiple environments from a developer’s local laptop to an on-premises data center and even the cloud. Benefits of containers include:
Less overhead Containers require less system resources than traditional or hardware virtual machine environments because they don’t include operating system images.
Increased portability Applications running in containers can be deployed easily to multiple different operating systems and hardware platforms.
More consistent operation DevOps teams know applications in containers will run the same, regardless of where they are deployed.
Greater efficiency Containers allow applications to be more rapidly deployed, patched, or scaled.
Better application development Containers support agile and DevOps efforts to accelerate development, test, and production cycles.
Container use cases
Common ways organizations use containers include:
“Lift and shift” existing applications into modern cloud architectures Some organizations use containers to migrate existing applications into more modern environments. While this practice delivers some of the basic benefits of operating system virtualization, it does not offer the full benefits of a modular, container-based application architecture.
Refactor existing applications for containers Although refactoring is much more intensive than lift-and-shift migration, it enables the full benefits of a container environment.
Develop new container-native applications Much like refactoring, this approach unlocks the full benefits of containers.
Provide better support for microservices architectures Distributed applications and microservices can be more easily isolated, deployed, and scaled using individual container building blocks.
Provide DevOps support for continuous integration and deployment (CI/CD) Container technology supports streamlined build, test, and deployment from the same container images.
Provide easier deployment of repetitive jobs and tasks Containers are being deployed to support one or more similar processes, which often run in the background, such as ETL functions or batch jobs.
Containers vs. Virtual Machines (VMs): What’s the Difference?
What Are Virtual Machines (VMs)?
Historically, as server processing power and capacity increased, bare metal applications weren’t able to exploit the new abundance in resources. Thus, VMs were born, designed by running software on top of physical servers to emulate a particular hardware system. A hypervisor, or a virtual machine monitor, is software, firmware, or hardware that creates and runs VMs. It’s what sits between the hardware and the virtual machine and is necessary to virtualize the server.
Within each virtual machine runs a unique guest operating system. VMs with different operating systems can run on the same physical server—a UNIX VM can sit alongside a Linux VM, and so on. Each VM has its own binaries, libraries, and applications that it services, and the VM may be many gigabytes in size.
But this approach has had its drawbacks. Each VM includes a separate operating system image, which adds overhead in memory and storage footprint. As it turns out, this issue adds complexity to all stages of a software development lifecycle—from development and test to production and disaster recovery. This approach also severely limits the portability of applications between public clouds, private clouds, and traditional data centers.
What Are Containers?
Operating system (OS) virtualization has grown in popularity over the last decade to enable software to run predictably and well when moved from one server environment to another. But containers provide a way to run these isolated systems on a single server or host OS.
Containers sit on top of a physical server and its host OS—for example, Linux or Windows. Each container shares the host OS kernel and, usually, the binaries and libraries, too. Shared components are read-only. Containers are thus exceptionally “light”—they are only megabytes in size and take just seconds to start, versus gigabytes and minutes for a VM.
Containers also reduce management overhead. Because they share a common operating system, only a single operating system needs care and feeding for bug fixes, patches, and so on. This concept is similar to what we experience with hypervisor hosts: fewer management points but slightly higher fault domain. In short, containers are lighter weight and more portable than VMs.
Virtual machines and containers differ in several ways, but the primary difference is that containers provide a way to virtualize an OS so that multiple workloads can run on a single OS instance. With VMs, the hardware is being virtualized to run multiple OS instances. Containers’ speed, agility, and portability make them yet another tool to help streamline software development.