Convert docker-compose.yml into an architecture diagram.
A Compose file is a complete description of a small system written in a format that hides its shape.
What maps cleanly
Services become components. Images identify tiers by recognisable name, so postgres and redis land in data while nginx lands at the edge. Published ports mark what is externally reachable and named volumes mark what holds state, which is the distinction most worth having when someone is deciding what can be restarted.
The edges are partly inferred
depends_on gives explicit edges and is usually incomplete, because it only controls startup ordering and many teams stop maintaining it. The more informative edges come from environment variables where one service names another's address, and from shared network membership. Those inferred edges are the ones worth checking.
Best used for onboarding
A Compose file is the first thing a new engineer runs and among the last they understand. Putting the generated diagram in the README turns a file people copy commands from into an explanation of what they just started.
Fidelity
| Comes through | Does not | |
|---|---|---|
| services | One component each | |
| depends_on | Explicit edges | Often incomplete in practice |
| ports | Marks external reachability | |
| volumes | Marks stateful, data tier | |
| networks | Reachability grouping | |
| environment references | Inferred edges | Worth verifying |
| healthcheck | As a note | |
| Production topology | Compose describes local, not production |
The prompt
Questions
Does it need Docker installed?
No, it reads the YAML file.
Multiple compose files?
Yes, including the override pattern. Merging them first gives the most accurate result, since that is what Compose itself would use.
Is this useful for production?
As a starting point you then correct. Terraform or Kubernetes manifests describe production far better.
Related
- Convert Kubernetes YAML to a DiagramThe whole topology is in the YAML, expressed as label matches spread across forty files.
- Convert Excalidraw to SVGA small utility, published because it solved a real problem here and the usual approach needs a DOM and about 1.4 MB of dependencies.
- Convert Mermaid to an Architecture DiagramMermaid gives you the graph. What it cannot give you is tiers, icons, and a layout that survives the diagram growing.
- Convert Code to a DiagramThe general case: point it at code and get a diagram of what is there rather than what you remember building.
Last updated