# Container Diagram (C4 Level 2)

**In short:** A container diagram zooms into one software system and shows its separately running parts: applications and data stores. It also shows the main technologies and how the parts talk to each other.

## Explanation

A container diagram is the second level of the C4 Model (see the article "C4 Model"). It zooms in from the System Context Diagram, which shows the system as a single box. The container diagram opens that box.

**What a container is.** In C4, a container is either an application or a data store. It is a runtime boundary: a border around code that is being executed or data that is being stored. A container is also something that must be running for the whole system to work.

**Typical containers.**
- A server-side web application.
- A client-side single-page application, for example a JavaScript app running in a web browser.
- A desktop application.
- A mobile app.
- Data stores such as a database or a file system. A file system can be a full local one or part of a larger networked one.

**What the diagram shows.** Each container appears with its major technology choice. The arrows show how containers communicate with one another. Readers can see which parts exist, what they are built with, and how they connect.

**Who reads it.** The audience is technical people, both inside and outside the development team.

**What it leaves out.** The diagram says very little about deployment topics such as clustering, load balancers, replication or failover. Those belong in deployment diagrams (see "Deployment View").

**Link to arc42.** Community guides map the arc42 building block view, level 1, to C4 containers. Level 1 is the white box of the whole system. A white box shows the inner parts of a block. Level 2 of that view zooms into some level-1 blocks. It is analogous to the C4 component level (see "C4 Component Diagram").

## Example

An online library system could have four containers. A single-page application runs in the reader's browser. A mobile app offers the same features on a phone. A server-side web application handles their requests. A database stores the book catalog. The arrows from the two apps to the web application are labeled with the protocol they use. The arrow from the web application to the database shows reads and writes. Each box names its technology.

## Trade-offs

The diagram gives a clear overview of the parts and their technologies. It does not show how those parts are deployed, such as clustering or failover. Teams that need that information must add a separate deployment diagram. It also does not show the inner structure of a single container. That detail belongs in the next level, the component diagram.

Generic container diagram of an invented online library system.

```plantuml
@startuml
!include <C4/C4_Container>
Person(reader, "Reader", "Uses the library")
System_Boundary(lib, "Online Library") {
  Container(spa, "Single-page app", "JavaScript, browser", "Search and borrow screens")
  Container(mobile, "Mobile app", "Mobile", "Same features on a phone")
  Container(web, "Web application", "Server-side", "Handles requests")
  ContainerDb(db, "Catalog database", "Database", "Stores books")
}
Rel(reader, spa, "Uses")
Rel(reader, mobile, "Uses")
Rel(spa, web, "Calls", "HTTPS")
Rel(mobile, web, "Calls", "HTTPS")
Rel(web, db, "Reads and writes")
@enduml
```

## Checks

- The container diagram covers a single software system and follows from the system context view.
- Every container is an application or a data store that must be running for the system to work.
- Databases and file systems appear as containers.
- Each container shows its major technology, and the arrows show how containers communicate.
- Clustering, load balancing, replication and failover are not detailed here but in deployment diagrams.

## Related

- [C4 Model](https://arc.fuet.ch/concepts/documentation/c4-model.md)
- [System Context Diagram](https://arc.fuet.ch/concepts/documentation/c4-level-1-system-context-diagram.md)
- [C4 Component Diagram](https://arc.fuet.ch/concepts/documentation/c4-level-3-component-diagram.md)
- [Deployment View](https://arc.fuet.ch/concepts/documentation/distribution-view.md)
- [arc42 Architecture Documentation Template](https://arc.fuet.ch/concepts/documentation/arc42-documentation-template.md)
- [Architectural Overview Diagram](https://arc.fuet.ch/concepts/documentation/architectural-overview-diagram.md)

## Sources

- [Container diagram | C4 model](https://c4model.com/diagrams/container) — c4model.com, accessed 2026-11-09
- [Container | C4 model](https://c4model.com/abstractions/container) — c4model.com, accessed 2026-11-09
- [5 - Building block view | arc42 Documentation](https://docs.arc42.org/section-5/) — docs.arc42.org, accessed 2026-11-09
