# Introduction to Containers

## What Are Containers?

At a high level, containers are logical constructs that contain the binaries for an application. The binaries run at higher level of infrastructure abstraction than virtual machines. In contrast to a virtual machine, which carries an entire operating system to provide a runtime environment for an application's binaries, a container bundles only an application's binaries and its required binaries. It is assumed that when you run the container, an abstraction layer schedules access to a shared operating system.

In general, a container can refer three things:

* A container runtime, such a Docker&#x20;
* An instance of a running container
* A container Image

In a similar way to how a Linux kernel helps run application processes by providing hardware resources, a container runtime helps partition the Linux kernel to run isolated Linux processes with specific resource limits around CPU, memory, etc. A runtime also helps isolate application processes by using two Linux kernel primitives: [control groups (cgroups)](http://man7.org/linux/man-pages/man7/cgroups.7.html) and [namespaces](http://man7.org/linux/man-pages/man7/namespaces.7.html). Cgroups limit resources to a set of processes running on a Linux host, and namespaces isolate processes from one another. Although Docker is the most popular example of a container runtime, there are others, such as rkt.

A container can also refer to a running instance of a container image. A running container is the set of processes (typically an application) that a container runtime helps support by ensuring the necessary constructs in the Linux kernel are created to limit resource consumption and provide isolation.

A container image is a format to port a running container from one Linux host to another.&#x20;

**Here's a** [**video**](https://www.youtube.com/watch?v=EnJ7qX9fkcU) **that explains what containers are:**&#x20;

{% embed url="<https://www.youtube.com/watch?v=EnJ7qX9fkcU>" %}

**Here's a Containers 101** [**video**](https://www.youtube.com/watch?v=VqLcWftIaQI)**:**&#x20;

{% embed url="<https://www.youtube.com/watch?v=VqLcWftIaQI>" %}

## How Do Containers Help?

Containers sit at a higher level of infrastructure abstraction than other infrastructure, such as virtual machines. By doing so, containers improve **application portability, server elasticity, and server resource utilization**. In addition, a container runtime can schedule multiple containers on a shared operating system, producing many benefits for both infrastructure operators and application  developers.

**Benefits for Operations, Infrastructure, and IT Teams**

* Lowers the operating system footprint that needs to be managed across  servers
* Reduces an application's dependencies on an operating system
* Eases maintenance and shortens maintenance windows

**Benefits for Application Development Teams**

* Because containers decouple an application and its dependencies from the operating system, development teams can skip creating multiple test environments with various operating systems for validating application behavior&#x20;
* Streamlines the development pipeline to reduce the time to build and ship applications

**All of these benefits produce a compelling result: Containers shorten the time it takes to build, test, and ship applications.**
