What Are Containers?

A container is a unit of lightweight, executable software that packages application code and its dependencies in a standardized way. This packaging allows an application to be mobile and executed across different locations.

How Containers Work?

Containers enable the abstraction away from an operating system and the infrastructure that an application needs to run on. In order to explain how containerization achieves this, it is important to understand the main concepts and components involved.

  • The container image contains the all the information for the container to run, such application code, operating system, and other dependencies (e.g., libraries). There are multiple container image formats, most common of them being the Open Container Initiative (OCI).
  • The container engine pulls the container images from a repository and runs them. There are a number of container engines such as Docker, RKT, LXD. Container engines can run on any container host, such as on a laptop, on a data center physical server, or in the public cloud.
  • The container is a container image that has been initiated or executed by the container engine.

Containers versus Virtual Machines (VMs)

Containers are often compared to Virtual Machines (VMs), as they are both portable single units of packaged compute; however, they are solving different problems. Where VMs aim to abstract an operating system from the physical server, containers aim to create an environment for application code to be executed in. Similar to how VM hypervisors virtualize the hardware to host multiple isolated operating systems, the container engine virtualizes the operating system to host multiple isolated applications. Containers are naturally smaller in size, compared to VMs, as they are purposely built to run applications, and package only the absolute minimum amount of data and executables required.

Containers have introduced the concept of immutability, as they do not need to be updated or patched, as with virtual machines. Any updates require an existing container to be destroyed and replaced with a new one.

Why containers?

The major benefits of containers for both developers and IT operations and infrastructure teams are consistency and lower overhead. Containerized applications are independent from virtualized and physical infrastructure, allowing developers to make changes to their code and include any new dependencies into a new container.

This is done without worrying about the application not running due to some incompatibility. At the same time, IT operations and infrastructure teams can look after the infrastructure that hosts the containerized applications, without spending time making updates when there is a new application or application change.

What is container orchestration?

Despite the benefits that containerization brings, as with any system, as it scales, so do the operational complexity and overhead. While managing tens of containers can be easy, managing thousands becomes a challenge.

Container orchestrators are software platforms that address this through automating the lifecycle management of containers, including all the manual tasks involved in:

  • Provisioning and deployment
  • Resource allocation
  • Uptime and application health
  • Dynamic scaling up and down
  • Service discovery
  • Networking, security, and storage

The most popular container orchestration platform is Kubernetes (K8s). Kubernetes can be deployed on top of almost any infrastructure, on-premises, at the edge, or on public clouds.