Docker Compose Visualizer
Operator: Abdulla Al Fahad. How tools are built and checked
A Compose file that has grown past a screen is hard to review: which service waits for which, which one publishes a database to every network interface, and whether the password in the environment block is real. Reading the YAML top to bottom does not answer those, so this page turns it into a layered graph and a list of findings.
Each service becomes a box with its image, published ports, networks and profiles. Arrows run from a service to what it depends on, dashed when a condition such as service_healthy is attached, and the lint rules sit beside the graph.
Nothing is started or pulled and nothing leaves the tab; the file is only parsed.
Key features
- Dependency graph in layers, with the services at the bottom of the chain drawn lowest, condition labels on dashed arrows, coloured dots for networks and a red border for privileged services and Docker socket mounts
- Services table with image or build context, published ports with host IP, depends_on with conditions, networks, mounts, healthcheck state and profiles
- 27 lint rules numbered DC001 to DC100, each with the reason and a fix, filterable to errors only
- Secret audit of environment and build args by variable name and by value pattern (private keys, AWS key IDs, GitHub and Slack tokens, JWTs, URLs with a password), with values masked after two characters
- Same-file extends and YAML anchors with << merges resolved before linting; extends from another file and include are reported, not followed
- Export as SVG, PNG, Markdown report or findings CSV
How anchors, extends and depends_on are resolved before linting
The YAML goes through the project's own parser, which handles anchors, aliases and the << merge key, and refuses a file whose aliases would expand to more than a million values. Compose-specific shapes are then normalised: ports in short and long form, volumes as src:dst:mode or a mapping, environment as a map or a KEY=value list, depends_on as a list or a map with condition and required.
extends with a service name is merged the way Compose does it as closely as the page can: mappings are merged key by key, lists such as ports and cap_add are appended, volumes are merged by container path (an entry in the child replaces the parent's entry with the same target), environment and labels are merged by name, and other scalar and list settings of the child replace the parent's. A loop, or a chain deeper than ten, is an error.
How it works
Layers come from the longest chain of depends_on below each service, found by repeated relaxation that stops after one pass per service, so a dependency cycle cannot make it loop; cyclic files are drawn flat and reported by rule DC014.
Secret detection looks at variable names such as password, secret, token, api_key and private_key, skips ${VAR} references and *_FILE variables, and separately scans values. A match on a well-known default (changeme, postgres, admin) is raised from a warning to an error.
When this helps
- A platform engineer taking over a 34-service Compose file for a staging environment draws the graph first to see that nine services only wait for the message broker.
- A reviewer on a pull request that adds a database service checks the findings and sees DC051: the port mapping binds 0.0.0.0, and the fix is to write 127.0.0.1:5432:5432.
- A developer whose docker compose up stops at once with an error that the db container has no healthcheck configured finds DC011 in the page: api waits for db with condition service_healthy, and nothing in the file defines a healthcheck for db.
- A security reviewer exports the Markdown report with masked secret values and attaches it to an audit ticket.
- A team that moved services into profiles finds DC012, a required dependency that sits in a profile the default start does not enable.
Opening a file
- Paste docker-compose.yml, drop the file, or choose Load example, then choose Visualize.
- Read the Graph tab, then Findings. Use the Errors filter first.
- Open Secrets to see which variables hold plain-text values, then Export for SVG, PNG or Markdown.
- Fix the file and paste it again; there is no state to clear.
- To review a change, compare the finding counts before and after in the Findings tab, or export the findings CSV from each version.
Example
A shop stack: web, api, db, cache and a worker that extends api
web depends on api (service_healthy), api depends on db (service_healthy) and cache
api mounts /var/run/docker.sock and a volume uploads that is never declared
db is postgres:16.4 with POSTGRES_PASSWORD: postgres and port 5432 published
worker: extends api, profile jobsLayers, findings and secrets for the five services
3 layers: db and cache, then api and worker, then web
14 findings: 8 errors, 4 warnings, 2 info
errors include DC011 (web waits for api to be healthy but api has no healthcheck), DC030 (undeclared volume uploads), DC031 (Docker socket mounted) and DC100 (JWT_SECRET: changeme, POSTGRES_PASSWORD: postgres)
warnings: nginx:latest, Postgres published on every interface, DATABASE_URL carrying a password
5 plain-text secrets (api and the worker that extends it each count)Limits
Variables stay as written. A condition or image tag that depends on ${TAG} is shown as the text, and the page cannot tell whether it resolves to latest.
env_file contents are not read, so a secret kept there is not found, and a service whose environment lives entirely in env_file shows no variables.
Rules describe the file, not the running system. A port published in the file may be blocked by a firewall, and a socket mount may be read-only behind a proxy.
include: and extends from another file are not followed, so services defined there are missing from the graph, and a note says so.
- Most official database images do not ship a healthcheck, so service_healthy needs one in your file; pg_isready for Postgres and redis-cli ping for Redis are the usual choices.
- Replace a plain-text secret with a secrets: entry and a file, or with ${VAR} filled from an .env file kept out of version control.
Common errors and how to fix them
- The file has no services: mapping.
- A Compose file lists its containers under a top-level services key. Check indentation, and paste the whole file, not a single service block.
- extends forms a loop: a -> b -> a.
- Two services extend each other. Move the shared settings into a YAML anchor or into a third base service that neither extends back.
- The aliases in this file expand to more than a million values.
- Each anchor is used by several aliases that are themselves anchors, so the file is a decompression bomb. Flatten the anchors so each one is used once.
Best practices
- Pin images to a version tag or digest, and use condition: service_healthy only where the dependency has a healthcheck.
- Publish a database port only on 127.0.0.1 or not at all, since services on the same network reach it by service name without a published port.
- Declare every named volume, network and secret at the top level so a typo becomes an error instead of an empty volume.
What the rules cover
Dependencies (DC010 to DC014): unknown service, missing healthcheck for service_healthy, dependency in a different profile, started-only wait on a service that has a healthcheck, cycles. References (DC020, DC030, DC080, DC081): undeclared networks, volumes, secrets and configs. Isolation (DC022, DC031, DC040 to DC042): host networking, Docker socket, privileged mode, host PID and SYS_ADMIN. Exposure and hygiene (DC003, DC050, DC051, DC060, DC070, DC100): latest tags, duplicate host ports, databases on every interface, container_name with replicas, missing healthchecks and plain-text secrets.
Frequently asked questions
Does DC011 mean the image has no healthcheck?
It means the file defines none. An image can carry its own HEALTHCHECK instruction from its Dockerfile, and then service_healthy works without a healthcheck: key. The page cannot look inside an image, so it reports the rule as an error and says in the message that the image may supply one; when neither does, Compose stops with a no-healthcheck-configured error instead of waiting.
Are Windows-style bind mounts such as C:\data:/data read correctly?
Yes. A single letter followed by a colon and a backslash or slash is kept together as the drive, so the source is C:\data and the target /data, and the mount is classed as a bind mount rather than a named volume.
Why is the version key reported when old tutorials all start with it?
The Compose Specification ignores version, and current Compose prints a warning when it sees one, so the page reports it as information with the advice to delete the line.