What are containers (containerisation)?

A container is a packaged application, with its runtime and libraries, that runs as an isolated process on a shared operating system kernel. Containerisation makes software start fast and run the same on a laptop and in the cloud.

Also called containerisation, containerization, docker container, container imageUpdated

"It works on my machine" usually means the production server has a different language version, a missing library or another setting. A container solves this by shipping the application together with everything it needs to run. The same image runs on a developer's laptop, in the CI pipeline and in production.

How containers work

A container is an ordinary process on a Linux host that the kernel isolates from other processes.

  • Namespaces give it its own view of process IDs, the network, the file system and users.
  • Control groups (cgroups) cap how much CPU and memory it can use.
  • A container image holds the file system: a base layer (for example a slim Debian or Alpine), the language runtime, your dependencies and your code. Images are built in layers, so a rebuild only replaces the layers that changed.

The Open Container Initiative (OCI) standardises the image format and runtime, so an image built with Docker also runs on Podman, containerd, Kubernetes, AWS ECS, Google Cloud Run or Azure Container Apps.

Containers vs virtual machines

Container Virtual machine
Isolates A process A whole computer
Kernel Shared with the host Its own guest operating system
Size Usually megabytes Usually gigabytes
Start time Seconds or less Typically tens of seconds to minutes
Isolation strength Weaker, as all containers share one kernel Stronger, enforced by the hypervisor

In the cloud you usually get both: containers run on virtual machines. When tenants must not trust each other, platforms add a stronger sandbox, such as a lightweight VM per workload (AWS Firecracker) or a user-space kernel (gVisor).

Example: a Dockerfile for a Node.js API

FROM node:22-slim
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --omit=dev
COPY . .
USER node
EXPOSE 3000
CMD ["node", "server.js"]

docker build -t orders-api:1.4.2 . produces an image. The pipeline pushes it to a registry such as Amazon ECR, scans it for known vulnerabilities and deploys that exact tag. Copying the package files before the source code means dependency installation is cached, so most rebuilds take seconds. USER node stops the process running as root.

Containerisation and orchestration

One container is easy to run. Fifty services with three copies each need an orchestrator to place containers on machines, restart failed ones, scale on load and roll out new versions. Kubernetes is the most common choice. Managed alternatives such as ECS, Fargate and Cloud Run hide more of the work. We compare them in Kubernetes vs ECS vs Cloud Run.

Orchestrators also make safer releases practical, such as blue-green deployments and canary releases.

Common mistakes

  • Storing data inside the container. Containers are disposable, so use a managed database or a mounted volume.
  • Using latest as the image tag in production, which makes rollbacks guesswork.
  • Large images full of build tools and shells. Use multi-stage builds and slim base images.
  • Baking secrets into the image. Inject them at runtime from a secrets manager.

We build container platforms and pipelines through our cloud and infrastructure work.

Any idea in mind? Let's make it real.

Tell us what you're building. You'll hear back from an engineer, not a sales team, usually within one working day.

Book a 30-min call