Skip to content

Container

Also called: containers, application container, Docker container

Published:

How does a container work?

NIST describes application containers as operating system virtualisation combined with application software packaging. They give teams a portable, reusable and automatable way to package and run applications [1]. Docker's own guide is blunter: a container is an ordinary process on your computer that runs in isolation [2]. Each one gets its own filesystem, its own view of processes, network interfaces and hostname, and optional limits on memory and CPU [2].

Take a Node.js server. Run it in a container and it cannot see the other applications on the machine or their files [2]. The same package then behaves the same way on a developer's laptop and on a production server.

How is a container different from a virtual machine?

A virtual machine also isolates software, but it does so by pretending to be a whole computer, and each VM boots a full operating system with its own kernel. A container has no operating system to boot, so it starts in about a second [2]. The trade-off is isolation. Every container on a machine shares that machine's kernel, while VMs are separated by the hardware boundary the hypervisor creates, which makes their isolation stronger [2]. Kernel sharing is also why Linux containers on macOS and Windows run inside a small Linux VM managed by Docker Desktop [2]. NIST's guide covers the security concerns this model raises and how to address them [1].

Frequently asked questions

Is Docker the same as a container?

No. A container is the technique; Docker is one of the tools used to build and run containers.

Sources

  1. SP 800-190, Application Container Security Guide — NIST CSRC
  2. What is a container? — Docker Docs