Code Safari

Chapter 121·Intermediate·9 min read

Containers in Production (and Where Kubernetes Fits)

A plain-English guide to running containers in production — what changes with real traffic and uptime, the problems of scaling, self-healing, and rolling updates, why orchestration exists, what Kubernetes actually does, and when you do (and don't) need it. From your laptop to the real internet.

July 19, 2026

Every chapter so far has run containers on your machine, for you. This final chapter is about the leap that changes everything: running containers in production, where real users hit them, where "down" costs money and trust, and where the app must stay up around the clock through crashes, traffic spikes, and deployments. The container skills you've built are exactly right — but production asks a whole new set of questions, and answering them is why an entire category of tooling, crowned by Kubernetes, exists. This is the bridge from your laptop to how software actually runs on the internet.

What production changes

On your laptop, running a container is simple: docker run, and if it crashes you start it again. That casual approach falls apart the instant real users depend on it. Production introduces demands that simply don't exist in development:

  • It must stay up. If a container crashes at 3 a.m., users hitting errors is not acceptable — something has to fix it immediately, without waiting for a human.
  • One copy isn't enough. A single container can only handle so much traffic, and if it dies, your whole app is down. Real systems run several identical copies.
  • Deploys can't cause downtime. Shipping a new version by stopping the old container and starting a new one means a gap where the app is offline. At scale, that gap is unacceptable.
  • It spans many machines. Serious systems run across a fleet of servers, and something has to decide which container runs on which machine.

The three production problems

Before naming any tool, it's worth feeling the three concrete problems that production forces, because a good orchestrator is really just an automated answer to these three.

Scaling. One container handles limited load. Because your image is identical every time (chapters two and three), you can run many copies of it and spread incoming requests across them with a load balancer — a concept straight from the system-design foundations: one front door distributing traffic to many identical workers behind it. The question is who starts, tracks, and balances those copies.

Self-healing. Containers die — a bug, a memory spike, a hardware failure. In development you notice and restart. In production you can't have a human watching every container; the system itself must detect a dead or unhealthy container and replace it automatically. This usually rides on health checks: the app exposes a "am I okay?" endpoint, and the orchestrator pings it, replacing anything that stops answering.

Rolling updates. Deploying version 2 shouldn't mean taking version 1 fully offline. The safe pattern is a rolling update: replace the old containers with new ones a few at a time, so there are always healthy copies serving traffic and the app never goes dark. And if version 2 is broken, the same machinery can roll back to version 1 just as gradually.

All running v1
Swap a few v1 → v2
v2 healthy? continue
Repeat until all v2
Broken? roll back the same way
A rolling update keeps the app alive while it changes

Solve scaling, self-healing, and rolling updates and you've solved most of production. Doing it by hand — manually running copies, watching for deaths, carefully swapping versions across a fleet — is possible but brutal and error-prone. That manual labour is precisely what orchestration automates.

Orchestration, and what Kubernetes actually does

An orchestrator is a system that manages containers across a fleet of machines for you: it decides which container runs where, scales them up and down, heals dead ones, and rolls out updates — all automatically. The dominant orchestrator, effectively the industry standard, is Kubernetes (often written k8s).

You don't need to operate Kubernetes to finish this guide — that's a whole field of its own — but you should understand the one idea at its heart, because it's genuinely elegant and it reframes everything. Kubernetes is built on declared desired state. Instead of issuing commands — "start a container," "now start another" — you declare the end state you want: "I want 5 copies of myapp:1.4 running, each reachable on port 80, healthy." Kubernetes then continuously works to make reality match that declaration, and to keep it matching.

Everything Kubernetes is famous for — scaling, self-healing, rolling updates, load balancing across machines — is that reconciliation loop applied to the three production problems above. It's a lot of moving parts in practice, but the concept is that clean.

Do you actually need Kubernetes?

Here's the honest, important counterweight, because the industry's enthusiasm for Kubernetes leads a lot of people to reach for it far too early. Kubernetes is powerful and genuinely complex. Running it yourself is a serious undertaking, and for many projects it is real overkill.

Plenty of production apps run happily on much simpler setups: a single beefy server running Docker Compose, or — increasingly the sweet spot — a managed platform that runs your container for you and hides the orchestration entirely. Services like Google Cloud Run, AWS Fargate/App Runner, Render, Fly.io, and Railway take your image, run it, scale it, and heal it, without you touching a cluster. You hand them an image from a registry (last chapter); they handle production. For a huge range of applications, that's the right answer, and it lets a small team ship serious software without a dedicated infrastructure crew.

Where this leaves you — and the whole guide

Step back and see the full arc. You started with a black box — "works on my machine" and no idea why containers mattered. You now understand the entire journey: why containers exist and how they differ from VMs; the image-and-container distinction at Docker's core; writing a Dockerfile that builds fast; persisting data with volumes; networking containers into a system; describing a whole app in one Compose file; sharing images through registries; and finally, what production demands and how orchestration — Kubernetes or a managed platform — answers it.

That's not trivia. It's the packaging-and-shipping layer that essentially all modern software runs on, and it connects directly to the rest of the foundations you've been building: the Linux underneath every container, the ports and processes and logs you already know how to reason about, the CI pipelines that build and push your images, the system-design ideas of load balancing and scaling. Containers are where a lot of it comes together.

You don't need to master Kubernetes tomorrow. What you have is the thing that makes all of it approachable: a clear mental model of what a container is, what it's for, and how it grows from a single command on your laptop into the systems that run the internet. From here, every deployment tool, cloud platform, and orchestration layer is a variation on ideas you now genuinely understand.

Containers in Production (and Where Kubernetes Fits) | Code Safari