Introduction
Docker transformed how software is built, shipped, and run. Before Docker, deploying applications meant dealing with environment differences, dependency conflicts, and "works on my machine" problems. Docker solved this by packaging applications into containers — lightweight, portable units that include everything needed to run.
With over 71,000 GitHub stars (as Moby, the open-source project), Docker is the most widely used container platform. It is installed on millions of developer machines and production servers. The Docker Hub registry hosts millions of container images used billions of times per month.
What Docker Does
Docker provides tools to build container images (Dockerfile), store them (registries), and run them (Docker Engine). Containers share the host OS kernel but have isolated filesystems, processes, and networks. This gives near-native performance with the isolation benefits of virtual machines.
Architecture Overview
[Docker CLI / Docker Desktop]
|
[Docker Daemon (dockerd)]
|
[containerd]
Container lifecycle mgmt
|
[runc]
OCI runtime
Creates Linux containers
|
[Container = isolated process]
Namespaces: PID, NET, MNT, UTS
cgroups: CPU, memory limits
Overlay FS: layered filesystem
[Docker Ecosystem]
Dockerfile -> docker build -> Image
Image -> docker push -> Registry
Registry -> docker pull -> Image
Image -> docker run -> Container
docker-compose -> Multi-container appsSelf-Hosting & Configuration
# Dockerfile — multi-stage build
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:20-alpine AS runner
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
EXPOSE 3000
CMD ["node", "dist/server.js"]# docker-compose.yml
services:
app:
build: .
ports:
- "3000:3000"
environment:
- DATABASE_URL=postgres://user:pass@db:5432/mydb
depends_on:
- db
- redis
db:
image: postgres:16-alpine
volumes:
- pgdata:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: pass
redis:
image: redis:7-alpine
volumes:
pgdata:Key Features
- Containerization — package apps with all dependencies into portable units
- Dockerfile — declarative, reproducible image builds
- Docker Compose — multi-container application orchestration
- Layer Caching — fast incremental builds with cached layers
- Docker Hub — public registry with millions of pre-built images
- Multi-Stage Builds — smaller production images by separating build and runtime
- Volumes — persistent data storage across container restarts
- Networking — built-in DNS and network isolation between containers
Comparison with Similar Tools
| Feature | Docker | Podman | containerd + nerdctl | LXC/LXD | Kata Containers |
|---|---|---|---|---|---|
| Daemon | Yes (dockerd) | Daemonless | Yes (containerd) | Yes | Yes |
| Rootless | Supported | Default | Supported | No | No |
| Compose | docker compose | podman-compose | nerdctl compose | N/A | N/A |
| OCI Compatible | Yes | Yes | Yes | Partial | Yes |
| Desktop App | Yes | Yes (Podman Desktop) | No | No | No |
| Kubernetes | Via containerd | Via CRI-O | Native | N/A | Via CRI |
| Learning Curve | Low | Low | Moderate | Moderate | High |
FAQ
Q: Docker vs Podman — should I switch? A: Podman is a daemonless, rootless alternative. For most developers, Docker Desktop is more convenient. For production Linux servers where rootless matters, Podman is worth considering.
Q: Docker vs virtual machines? A: Containers share the host kernel and start in milliseconds. VMs include a full OS and take minutes to boot. Containers use far less disk and memory. Use VMs when you need full OS isolation or different kernels.
Q: How do I reduce Docker image size? A: Use multi-stage builds, Alpine-based images, .dockerignore files, combine RUN commands, and remove unnecessary dependencies. A typical Node.js app can go from 1GB to under 100MB.
Q: Is Docker free? A: Docker Engine (Moby) is open source and free. Docker Desktop is free for personal use, education, and small businesses (under 250 employees). Larger companies need a paid subscription.
Sources
- GitHub: https://github.com/moby/moby
- Documentation: https://docs.docker.com
- Docker Hub: https://hub.docker.com
- Created by Solomon Hykes (2013)
- License: Apache-2.0