A container diagram, and why the name misleads everyone.
The most useful diagram most teams do not have, and the worst-named one in the field.
A container diagram is C4 level 2. It takes the single box from the context diagram and opens it into the separately deployable or runnable things inside: web applications, mobile apps, API services, databases, message brokers, file stores. Each one shows its technology and each connection shows what flows across it and over what protocol. The word container predates Docker in this usage and does not mean a Docker container, which is the single most common misunderstanding of the whole model.
The name collision, dealt with first
C4 uses container to mean a thing that executes code or stores data and can be deployed on its own. A Postgres database is a container. A single-page application is a container. A Docker container is a packaging and runtime mechanism, and one C4 container might run as several Docker containers or none at all. Simon Brown has been explaining this since before Docker was popular, and it still causes more confusion than any other part of C4.
What makes it the most valuable level
Context is often obvious to anyone who works on the system, and component and code levels go stale faster than they can be maintained. Level 2 sits where the information is both non-obvious and stable: which services exist, what each one is written in, which datastore each owns, and what talks to what. That is the diagram a new engineer actually needs and the one most teams cannot produce on request.
Getting the granularity right
The usual failure is a diagram with forty boxes because someone listed every module. If it is not separately deployable, it is a component and belongs at level 3. The test is whether you could deploy it on its own, and applying it honestly usually collapses a sprawling diagram to a readable one.
Labelling the connections
An unlabelled arrow between two containers carries almost no information. A useful one says what and how: reads order history from, over HTTPS or via a queue, synchronously or not. Most of the value of a container diagram is in the edges, and most hand-drawn ones leave them bare.
Questions
Related
- What Is a System Context Diagram?One box for everything you own. The value is entirely in what surrounds it.
- What Is a Component Diagram?Useful for the one container that is genuinely complicated. Drawn far more often than that.
- What Is Agentic Coding?The difference is the feedback loop. An agent can find out it was wrong.
- What Is the C4 Model?Four levels of zoom on one system. Two of them get maintained; the other two usually do not.
Last updated