Docker Cheatsheet

Top commands.

Building images

Image builds are the foundation of every container workflow. Master the basic flags before reaching for build optimisations like BuildKit cache mounts and multi-arch tooling.

Running containers

Run flags decide blast radius and ergonomics. -d, --rm, and -v are the three flags you reach for daily; the rest are situational.

Inspecting containers

Inspection is the discipline of debugging containers without panic. ps, logs, and exec are the daily three; inspect is the deep-dive.

Managing images

Image management is its own discipline. Local cache fills up silently, tags drift between environments, and pruning is the routine that keeps disk free.

Cleaning up

Cleanup is its own discipline. Disk fills up silently between deploys; running prune on a schedule prevents the surprise outage at 3am when /var fills up.