Description
Your build has been running nine minutes because a one-line change reinstalled everything, the image it finally spits out is a gigabyte, and a scan just flagged that it runs as root with a secret baked into a layer. Nothing errored. That is Docker: it fixes “works on my machine” and quietly hands you a dozen new ways to be wrong, the cache that never invalidates, the Compose stack with a readiness race, the container that ships your API key to anyone who pulls it. It is easy to start and easy to misuse, so the gap is not the commands. It is knowing what an image, a layer, and a container really are, so you build small, fast, safe ones instead of copying a Dockerfile you found and hoping.
This guide shows you how to use Docker on purpose, so the container you ship is small, fast, reproducible, and safe instead of a Dockerfile you copied and hoped about. It starts from what an image actually is, layers stacked into a filesystem, and builds up the mental model that makes everything else obvious: how the build works and why the layer cache makes or breaks your build time, how to write a Dockerfile that stays small with multi-stage builds and a tight base image, what a container really is when it runs as a process under namespaces and cgroups, how container networking and volumes connect services and persist data, what Docker Compose wires up for local development and the readiness race it hides, and how to harden an image and push it to a registry so the same bytes run in production. The book does not hand you a flag reference. It teaches you to read a Dockerfile and a compose file and judge them, to shrink a bloated image, to keep a secret out of a layer, and to know exactly what runs when your container starts. For engineers who are going to containerize their app either way and want to own what they ship.
Who this was written for
This guide is for: engineers who can run a docker command they copied but cannot reason about what it did, and want to build, run, and ship containers they actually understand.
Everything inside
- Chapter 1: The afternoon your code broke on someone else’s machine
- Chapter 2: Why a 312 MB image downloads only 40 MB
- Chapter 3: Read a Dockerfile and know exactly what it builds
- Chapter 4: The build that reinstalls what you never touched
- Chapter 5: Stop shipping a gigabyte to fix one line
- Chapter 6: A container is not the tiny machine you think it is
- Chapter 7: Your container is a sealed box until you open a door
- Chapter 8: From an eleven-step wiki to one command
- Chapter 9: The pentester typed whoami and it said root
- Chapter 10: How production runs an image you never tested
- Chapter 11: When the container dies the second it starts
- Chapter 12: When a crash stops being a shrug and becomes an outage
- Chapter 13: Own what you ship


