Container

A container is a lightweight, isolated package that holds an application and everything it needs to run, sharing the host operating system's kernel instead of carrying a full operating system of its own.

Also known as: Linux container, OCI container

Related terms in this glossary

How it works

A container starts from an image: a read-only, layered file system that holds the application, its libraries and a minimal set of operating system files. When the image runs, the container runtime uses Linux kernel features to isolate it:

  • Namespaces give the process its own view of processes, network, mounts and users.
  • Control groups (cgroups) limit how much CPU and memory it can use.
  • Security features such as seccomp and capabilities restrict what it can ask the kernel to do.

The Open Container Initiative (OCI), a Linux Foundation project, publishes standards for image format, runtime and distribution. That is why an image built with Docker, Podman or Buildah runs on containerd or CRI-O, and can be stored in any OCI-compliant registry.

Containers differ from virtual machines. A VM virtualizes hardware and runs a full guest operating system; containers share the host kernel. That makes them start in seconds and use less memory, but the isolation boundary is thinner, which is why sandboxed runtimes like gVisor and Kata Containers exist for untrusted workloads.

Why it matters

Containers solve the "works on my machine" problem: the same image runs in development, CI and production. They are the unit that Kubernetes and most modern platforms schedule. Good practice includes small base images, running as a non-root user, pinning versions and scanning images for vulnerabilities. See Gepton's Docker and containerization service.

Container in depth

Example: from source to a running container

Example: a hypothetical Python service is packaged with a multi-stage build. The first stage uses a full Python image to install dependencies into a virtual environment. The second stage starts from a slim or distroless base, copies only the virtual environment and the application code, sets a non-root user, and declares the start command. The resulting image is tagged with the Git commit, scanned, signed and pushed to a registry. On Kubernetes, the pod spec sets CPU and memory requests and limits, a read-only root file system, dropped Linux capabilities and a liveness and readiness probe. The same image runs unchanged in CI, staging and production.

Production practices for containers

  • Small, known base images: fewer packages means fewer vulnerabilities to patch. Distroless, Alpine or vendor-maintained minimal images are common choices, each with trade-offs in debugging and compatibility.
  • Pin by digest: tags like latest move; a digest identifies one exact image.
  • Least privilege at runtime: non-root user, no privileged mode, seccomp profile set to RuntimeDefault, minimal capabilities. Kubernetes Pod Security Standards describe baseline and restricted levels.
  • One process concern per container: sidecars for separate jobs such as log shipping or proxies.
  • Configuration from outside: environment variables, config maps and secret stores, never baked into images.
  • Graceful shutdown: handle SIGTERM so in-flight requests finish during rollouts and scale-downs.

Tools and standards

Images are built with Docker BuildKit, Buildah or Kaniko, run by containerd or CRI-O, and stored in OCI registries such as Amazon ECR, Azure Container Registry, Google Artifact Registry or Harbor. Scanners such as Trivy and Grype report known vulnerabilities, Syft generates SBOMs, and Sigstore Cosign signs images so clusters can verify them before running.

How to evaluate your container estate

CheckQuestion to answer
Image size and layersAre build tools and caches leaking into production images?
VulnerabilitiesHow many critical and high findings are fixable, and how old are they?
ProvenanceCan you trace each running image to a commit and pipeline run?
Runtime postureHow many containers run as root or privileged?
Resource settingsDo requests reflect real usage? See rightsizing

Rebuild images on a schedule, not only when code changes, so base image security fixes reach production. Automated tools such as Renovate or Dependabot can open pull requests when a new base image is published, and the normal pipeline then tests, scans and ships the rebuilt image like any other change.

Common mistakes

  • Secrets copied into an image layer, where they remain even if a later layer deletes them.
  • Treating containers like virtual machines: SSH inside, manual patching, long-lived state on the container file system.
  • No memory limits, so one leaking container can starve a node.
  • Base images that are never rebuilt, so fixes upstream never reach production.

Containers are built with tools such as Docker, scheduled by Kubernetes, observed at the kernel level with eBPF, and documented with an SBOM. We cover this work in Docker and containerization.

Questions about Container

Something else? Send us your question and an engineer replies with next steps.

Are containers secure enough for multi-tenant workloads?

Standard containers share the host kernel, so a kernel vulnerability or misconfiguration can let a process escape its isolation. For workloads from different customers or untrusted code, add stronger boundaries: separate nodes or clusters per tenant, sandboxed runtimes such as gVisor or Kata Containers, strict network policies and the restricted Pod Security Standard. For code from your own team running in your own services, well-configured containers with least privilege are usually adequate. The right level depends on what an escape would expose.

Should databases run in containers?

They can, and Kubernetes operators exist for PostgreSQL, MySQL and others that handle replication, backups and failover. But running stateful databases well in containers needs solid storage, tested backups and people comfortable debugging them under pressure. Many teams use managed database services from their cloud provider for production and run containerized databases for development, testing and preview environments. Decide based on your team's operational skills, recovery requirements and data residency needs rather than on a general rule.

Articles that mention Container

All articles

Jump to

↑↓ to move↵ to open