✦ For everyone, free.

Practical knowledge for real and everyday life

Home

Docker

A focused guide to Docker, connecting core concepts with practical Docker and container operations.

Docker is a containerization platform that packages an application together with everything it needs to run — code, runtime, system libraries, and configuration — into a single, portable unit called a container. Containers share the host operating system's kernel, which makes them dramatically lighter and faster to start than traditional virtual machines while still providing strong process and filesystem isolation.

Core Architecture

Docker is built around a client-server model. The Docker client communicates with the Docker daemon (dockerd), which does the heavy lifting of building, running, and distributing containers. The daemon and client can run on the same system or communicate remotely over a REST API, over UNIX sockets, or over a network interface.

Underneath the daemon, Docker relies on containerd as a container runtime, which in turn uses lower-level tools such as runc to create and run containers according to the Open Container Initiative (OCI) specification. This layered design separates orchestration concerns from the low-level mechanics of process isolation, namespaces, and control groups (cgroups) that the Linux kernel provides.

Images and Layers

A Docker image is a read-only template that defines a container's filesystem and startup configuration. Images are built from a Dockerfile, a text file containing a sequence of instructions — such as FROM, COPY, RUN, and CMD — that describe how to assemble the environment step by step.

Each instruction in a Dockerfile produces a filesystem layer, and Docker caches these layers so that unchanged steps in a build do not need to be repeated. Layers are stacked using a union filesystem, allowing multiple images to share common base layers (such as a Linux distribution) without duplicating data on disk. This layering model is central to Docker's efficiency: pulling a new image often only requires downloading the layers that are not already present locally.

Containers

A container is a running instance of an image. When a container starts, Docker adds a thin writable layer on top of the image's read-only layers, where any runtime changes to the filesystem are recorded. Containers are isolated from one another and from the host using Linux namespaces (for process IDs, network interfaces, mount points, and more) and constrained in their resource usage using cgroups, which limit CPU, memory, and I/O.

Because containers do not include a full operating system kernel, they start in a fraction of a second and consume far less memory and disk space than a comparable virtual machine.

Networking and Storage

Docker provides several networking modes for containers, including bridge networks, which give containers a private internal network with NAT-based access to the host, and overlay networks, which connect containers running across multiple hosts in a cluster. Containers can also share the host's network namespace directly when isolation is not required.

For persistent data, Docker supports volumes, which are managed storage locations that exist independently of any single container's lifecycle, and bind mounts, which map a path on the host filesystem directly into the container. Volumes are the preferred mechanism for data that must survive container restarts or be shared between containers.

Docker Compose and Orchestration

For applications composed of multiple cooperating containers, Docker Compose allows the entire stack — services, networks, and volumes — to be defined declaratively in a single YAML file and brought up or torn down with one command. This is widely used for local development environments and small-scale deployments.

For production-scale orchestration across many hosts, Docker integrates with systems such as Kubernetes, which schedules, scales, and heals containerized workloads across a cluster, handling concerns like service discovery, load balancing, and rolling updates that go beyond what a single Docker host can provide.

Distribution

Docker images are distributed through registries, with Docker Hub being the most widely used public registry. Organizations frequently run private registries to control access to proprietary images. An image is identified by a name and tag (for example, nginx:1.25), and registries support content-addressable storage so that identical layers are stored only once, reducing both storage and transfer costs.

Impact on Software Delivery

Docker's central contribution to software engineering has been to make environments reproducible and portable. A containerized application behaves the same way on a developer's laptop, in a continuous integration pipeline, and in production, because the container carries its dependencies with it rather than relying on the host environment being configured correctly. This consistency, combined with the speed and density containers offer compared to virtual machines, has made Docker a foundational technology in modern DevOps practices, microservices architectures, and cloud-native application development.

Content in this section