---
title: "Container"
url: https://www.daytona.com/compute-glossary/virtualization/container
---

# Container

Part of the [Compute Glossary](https://www.daytona.com/compute-glossary.md), section [Virtualization](https://www.daytona.com/compute-glossary/virtualization.md).

A container is a group of ordinary [processes](https://www.daytona.com/compute-glossary/kernel/process.md) that the host [kernel](https://www.daytona.com/compute-glossary/kernel/kernel.md) isolates from the rest of the system. It has no kernel of its own, so it is about as cheap to start as the program inside it. From the host, its processes show up in the normal process list beside everything else. What sets them apart is the restrictions the kernel puts around them.

The kernel gives the processes a private view of the system and a capped share of its resources. Because the image a container starts from carries the program with its libraries and files, the container runs the same way on any host. That promise, more than isolation, is what made containers popular with developers. It has limits, since the kernel and the processor architecture still come from the host.

Containers add little memory beyond the processes themselves, which is why they dominate packaging and deployment. The cost of that lightness is that every container on a host shares one kernel. A host can run far more containers than full virtual machines in the same memory. Lightness also makes them quick to replace, so platforms restart a failed container rather than repair it.

## Building blocks

The building blocks of a container are features of the Linux kernel that each restrict one aspect of a process. [Namespaces](https://www.daytona.com/compute-glossary/kernel/namespace.md) give the processes their own view of resources such as process IDs and mounts, so they see only what the runtime chose to share. Host files and devices that are mounted into the container stay visible. Inside, the first process sees itself as process 1 and sees only its own children. Each container usually also gets its own network stack and hostname.

[Control groups](https://www.daytona.com/compute-glossary/kernel/cgroup.md) limit and account for the processor time and memory the processes can use. Most runtimes also drop privileges and apply a [seccomp](https://www.daytona.com/compute-glossary/kernel/seccomp.md) filter that blocks system calls a typical program does not need. Dropping privileges means removing capabilities, the pieces into which Linux splits the powers of root. A process that runs as root inside a container therefore cannot do most of what root on the host can.

The root filesystem comes from a container image, usually stacked as read-only layers with a writable layer on top. The layers are shared through copy-on-write, so many containers from one image use one copy on disk. Changes a container makes land in its writable layer and vanish when the container is removed. Data that must outlive the container goes to a volume mounted from the host or the network.

## Container runtimes

Container runtimes are the programs that turn an image and a configuration into running processes. The work is split across layers, and the formats of the Open Container Initiative let the same image run under any of them. One specification fixes how an image is laid out, and another how a runtime is told to start it. Tools from different vendors can then build and run the same image.

A low-level runtime reads the configuration and starts the first process inside new namespaces and control groups. A higher-level runtime fetches images and manages each container's [lifecycle](https://www.daytona.com/compute-glossary/sandboxes/lifecycle.md), calling the low-level runtime to start each one. The low-level runtime usually exits once the container is running, leaving a small shim process to watch it. That keeps containers alive while the higher-level runtime restarts.

Platforms sit on top of these layers and add the tools and cluster scheduling that people use day to day. They leave the work of isolating processes to the runtimes below them. Kubernetes talks to runtimes through an interface of its own, so a cluster can swap one runtime for another. Most people meet containers only at this layer.

| **Layer**              | **Examples**         | **Description**                                                         |
| ---------------------- | -------------------- | ----------------------------------------------------------------------- |
| **Low-level runtime**  | runc or crun         | It creates the isolation for a container and starts its first process.  |
| **High-level runtime** | containerd or CRI-O  | It pulls and unpacks images and manages containers over their lifetime. |
| **Platform**           | Docker or Kubernetes | It gives people and clusters a way to build and run containers.         |

## Shared kernel

The shared kernel is the main weakness of containers as an [isolation boundary](https://www.daytona.com/compute-glossary/sandboxes/isolation.md). Its whole system call interface faces every container, and a bug in it can let a process in one container reach the host and the others. Root inside a container is still root to that kernel unless a user namespace maps it to an ordinary user. Many escapes in practice come from misconfiguration, such as a container given extra privileges.

A [virtual machine](https://www.daytona.com/compute-glossary/virtualization/virtual-machine.md) puts its own kernel and a hypervisor in the way, which is a smaller surface but costs a guest kernel per workload. For trusted code the shared kernel is a fair price, but for [untrusted code](https://www.daytona.com/compute-glossary/agents/untrusted-code.md) most operators add a second boundary. Which price to pay depends on who wrote the code more than on what it does. Code from a known team can share a kernel, while code from strangers or a model usually should not.

Two approaches sit between containers and virtual machines. The gVisor runtime serves system calls from a user-space kernel written in Go, and Kata Containers runs each container inside a lightweight virtual machine, often a [microVM](https://www.daytona.com/compute-glossary/virtualization/microvm.md). Both keep the images and tools that developers know, and change only what sits under the processes. The first costs speed on work that makes many system calls, while the second pays for a guest kernel.

## Related terms

- [Namespace](https://www.daytona.com/compute-glossary/kernel/namespace.md)
- [Control group](https://www.daytona.com/compute-glossary/kernel/cgroup.md)
- [Seccomp](https://www.daytona.com/compute-glossary/kernel/seccomp.md)
- [Virtual machine](https://www.daytona.com/compute-glossary/virtualization/virtual-machine.md)
- [MicroVM](https://www.daytona.com/compute-glossary/virtualization/microvm.md)
