Docker
Docker is a containerization platform that packages an application together with everything it needs to run — libraries, runtime, configuration — into a lightweight, portable container. The same container behaves identically on a developer's laptop, a staging box and production, eliminating the perennial "works on my machine" problem. Since its 2013 debut, Docker has become the de facto standard for shipping software and a cornerstone of DevOps practice.
How Docker works
Unlike full virtualization, containers do not emulate hardware or boot a separate kernel. They share the host's kernel while Linux primitives provide isolation: namespaces give each container its own view of processes, networking and the filesystem, and cgroups enforce CPU and memory limits. The core vocabulary:
- Image — an immutable, layered template built from a Dockerfile; layers are cached and shared, so rebuilds and pulls stay fast.
- Container — a running instance of an image with a thin, disposable writable layer on top.
- Registry — a repository of images (Docker Hub, GitHub Container Registry, private registries) that servers pull versioned images from.
- Volumes and networks — persistent data storage and inter-container communication.
- Docker Compose — a YAML definition of a multi-service stack (app, database, cache) started with a single docker compose up.
Docker in practice
Typical workloads where Docker earns its keep:
- Development environments — the whole project stack boots with one command, identical for every team member and disposable at will.
- CI/CD pipelines — the pipeline builds the image once, tests exactly that artifact, and deploys the same bytes to production (see CI/CD).
- Self-hosting on a VPS — each service runs isolated in its own container; upgrading means swapping the image tag, and rollback is reverting to the previous one.
- Orchestration at scale — across multiple hosts, Kubernetes or Docker Swarm schedules containers, adding scaling, service discovery and self-healing.
Good habits: prefer small base images (alpine or slim variants), use multi-stage builds to keep build tools out of runtime images, run one process per container, and scan images for known vulnerabilities before deploying.
Powiązane pojęcia
Najczęstsze pytania
How is a Docker container different from a virtual machine?
A VM emulates a full computer with its own kernel, so it weighs gigabytes and boots in minutes. A container shares the host kernel and isolates only processes and the filesystem — megabytes in size, starting in milliseconds. VMs offer stronger isolation; containers win on density, speed and portability.
