Docker cheat sheets

Docker packages an application and its dependencies into a lightweight container that runs identically anywhere. Three concepts sit under every command: an image (the immutable template), a container (a running instance of an image) and a volume (persistent storage that survives the container). Core commands covers the loop — run, ps, exec, logs, build — and the docker run flags you actually need. Docker Compose covers the compose.yaml file and the docker compose commands for multi-container apps. Cleanup & disk covers pruning images, containers, volumes and build cache — the part most people learn the hard way.

Every command is verified against the official Docker documentation and behaves identically on Docker Desktop (Windows/macOS) and Docker Engine (Linux). Two facts worth knowing up front: docker compose (no hyphen) is the current V2 plugin command — the old docker-compose V1 binary is deprecated — and stopped containers and dangling images quietly pile up until you prune them.

Cheat sheets

Network tools

Subnet CalculatorIPv6 CalculatorWildcard MaskRange → CIDRSplitterAggregatorVLSM CalculatorPracticeCheat Sheet

FAQ

What is Docker?

Docker is a platform for packaging applications into containers — lightweight, isolated environments that bundle an app with its dependencies and run identically on any host. Unlike a virtual machine, a container shares the host's kernel, so it starts in seconds and uses a fraction of the resources. Docker's three core objects are images (immutable templates), containers (running instances) and volumes (persistent data).

What is the difference between Docker and a virtual machine?

A virtual machine runs a full guest operating system on a hypervisor, each with its own kernel, so it is heavy and slow to boot. A container shares the host kernel and only isolates the application's userspace, so it starts in milliseconds and costs far less memory and disk. Containers give you process-level isolation, not hardware-level isolation.

What is Docker Compose for?

Compose lets you define a multi-container application (a web server plus a database plus a cache, for example) in one declarative compose.yaml file and manage the whole stack with docker compose up / down / logs. Without Compose you would string together many docker run commands by hand.

Where do I find images to run?

Docker Hub (hub.docker.com) is the default public registry, hosting official images for nginx, postgres, redis, node, python and thousands of others. docker pull downloads one, and docker run pulls automatically if the image is not local. Tag syntax is :, e.g. postgres:16 — the tag :latest is implied when omitted.