Containers in Production

The lifecycle from source to running process, layers and caching, what image size actually costs, and the process and signal model that decides whether deploys drop requests.

The Container Lifecycle

The full path from a build context to a process serving traffic, and back to a stopped container — with the failure that belongs to each hop.

Q · What is the complete sequence between `docker build` and a process serving requests, and which step is failing when a deploy does not work?
Layers and the Build Cache

Why one changed line rebuilds everything below it, why a deleted file is still in the image, and how instruction order decides both.

Q · Why does changing one line of source sometimes rebuild almost nothing and sometimes rebuild everything?
What Image Size Actually Costs

Size is paid on cold pulls and nowhere else — and an image with no shell is a real operational cost that nobody puts on the other side of the ledger.

Q · What does a large image actually cost, and when is making it smaller the wrong optimisation?
Multi-Stage Builds

Compile in one image, ship another — so the toolchain, the source and the build credentials never reach production.

Q · How do you build inside a container image without shipping the compiler, the source tree and everything the build needed?
Image Versus Container

An image is an immutable package; a container is a running instance of it with a throwaway writable layer — which is why nothing you change inside one survives.

Q · What is the difference between an image and a container, and why does it decide where state is allowed to live?
PID 1 and Signals

The entrypoint becomes PID 1, PID 1 does not get default signal handling, and a shell wrapper in between is why your container ignores SIGTERM.

Q · Why does my container ignore the stop signal and take the full grace period to die every single time?
Graceful Shutdown

Signal, stop accepting work, drain what is in flight, release resources, exit — inside a hard timeout you do not control.

Q · What must a container do between receiving a termination signal and exiting, so that a rollout does not drop user requests?
Debugging a Container in Production

What survives a container's death, what does not, and the order to ask questions in when there is no shell and the evidence is being deleted on every restart.

Q · The container is crash-looping and the image has no shell. What do you actually look at, and in what order?