Docker Cheat Sheet¶
Scannable commands and patterns for the Docker track. Prefer the full tutorials when you need why, not only how.
Quick reference¶
| Area | Commands / notes |
|---|---|
| Run | docker run --rm -it image sh; -p; -e; -v |
| Images | docker build -t; docker images; docker rmi |
| Containers | docker ps -a; docker logs -f; docker exec -it |
| Dockerfile | Multi-stage; non-root USER; .dockerignore |
| Compose | docker compose up -d; logs; down -v |
| Network | docker network ls; bridge vs host vs none |
| Volume | named volumes vs bind mounts; backup patterns |
| Registry | docker login; push/pull; digests vs tags |
| Debug | docker inspect; stats; healthchecks |
| Security | rootless; read-only rootfs; secrets not in ENV |
Common mistakes¶
- Copy-pasting without reading expected output
- Skipping cleanup (leftover containers, state, or temp files)
- Mixing production credentials into lab shells
Related¶
- Track: Docker
- Start: Docker introduction
- Interview bank: Docker interview prep
- Learning path: DevOps Engineer