docker-compose-graph

command module
v0.0.0-...-3cdc9e2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2025 License: MPL-2.0 Imports: 5 Imported by: 0

README

docker-compose-graph

A simple command-line tool that constructs a DOT graph of service and volume dependencies within a given set of docker-compose files.

Usage example

❯ go run main.go examples/simple.yaml

digraph compose {
  graph [fontname = "arial"];
  node  [fontname = "arial"];
  edge  [fontname = "arial" color = "/greys8/8"];
  subgraph cluster_0 {
      label = "simple.yaml"
      shape = "box"
      style = "rounded,bold,dashed"
      color = "/greys8/8"
    my_database                          [shape = "cylinder"   style = "rounded,bold,filled"    fillcolor = "/bugn8/7"   color = "/bugn8/8"   fontcolor = "white"      label = "my-database"];
    my_service                           [shape = "box"        style = "rounded,bold,filled"    fillcolor = "/blues8/7"  color = "/blues8/8"  fontcolor = "white"      label = "my-service"];
    my_volume                            [shape = "cylinder"   style = "rounded,bold,filled"    fillcolor = "/greys8/7"  color = "/greys8/8"  fontcolor = "white"      label = "my-volume"];
  }
  subgraph cluster_1 {
      label = "Legend"
      shape = "box"
      style = "rounded,bold,dashed"
      color = "/greys8/8"
    service1                             [shape = "box"        style = "rounded,bold,filled"    fillcolor = "/blues8/7"  color = "/blues8/8"  fontcolor = "white"      fontsize = "8pt"  label = "service1"];
    database                             [shape = "cylinder"   style = "rounded,bold,filled"    fillcolor = "/bugn8/7"   color = "/bugn8/8"   fontcolor = "white"      fontsize = "8pt"  label = "database"];
    volume                               [shape = "cylinder"   style = "rounded,bold,filled"    fillcolor = "/greys8/7"  color = "/greys8/8"  fontcolor = "white"      fontsize = "8pt"  label = "volume"];
  }
  my_database                            -> my_volume                              [style="bold,dashed"];
  my_service                             -> my_database                            [style="bold" arrowhead="diamond"];
  my_service                             -> my_volume                              [style="dashed"];
}

To generate an image, pipe the output to dot:

❯ go run main.go examples/simple.yaml | dot -Tsvg > examples/simple.svg

example

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL