Skip to content
Infrastructure

Docker

Definition & meaning

Definition

Docker is an open-source platform that packages applications and their dependencies into lightweight, portable containers that run consistently across any environment. Containers share the host operating system kernel, making them faster and more resource-efficient than traditional virtual machines. Docker has become the standard for application containerization, enabling reproducible builds, simplified deployments, and microservices architectures.

How It Works

Docker is a platform that packages applications and their dependencies into lightweight, portable units called containers. A container runs as an isolated process on the host operating system, sharing the host kernel but with its own filesystem, network stack, and process tree — achieved through Linux namespaces and cgroups. Developers define their environment in a Dockerfile: a text file with instructions to build an image layer by layer. Each instruction (FROM, RUN, COPY, CMD) creates a read-only layer that is cached and reused, making subsequent builds fast. Images are stored in registries (Docker Hub, GitHub Container Registry, Amazon ECR) and pulled by any machine with Docker installed. Docker Compose extends this to multi-container applications — defining a web server, database, cache, and message queue in a single docker-compose.yml file that launches with one command. Containers typically start in under a second, compared to minutes for virtual machines, because there is no guest operating system to boot.

Why It Matters

Docker solves the "it works on my machine" problem definitively. By packaging the application with its exact runtime, dependencies, system libraries, and configuration, Docker guarantees identical behavior across development, staging, and production environments. This consistency eliminates entire categories of deployment bugs caused by environment differences. Docker also enables microservices architecture: each service runs in its own container with its own dependency tree, deployable and scalable independently. For development teams, Docker Compose provides reproducible local environments — new developers run docker compose up and have a fully working system in minutes, regardless of their host operating system. We use Docker in every project to ensure parity between local development and production.

Real-World Examples

Docker is used by 55% of professional developers according to Stack Overflow surveys. Docker Hub hosts over 14 million container images. A typical web application Dockerfile starts FROM node:20-alpine, copies package.json, runs npm ci, copies source code, builds the application, and defines the start command. Multi-stage builds reduce production image sizes by 70-90% by separating build dependencies from runtime. Docker Compose orchestrates local stacks — a Next.js app, PostgreSQL database, Redis cache, and Mailhog email server all defined in one file. GitHub Actions and GitLab CI run pipeline steps in Docker containers for reproducibility. Testcontainers spins up real databases in Docker for integration tests. Distroless and Chainguard images minimize the attack surface for production deployments.

Related Terms