$ dok tree

Tree view of compose projects, networks and volumes

Synopsis

dok tree [OPTIONS]

Description

Three trees: compose projects and their containers, networks with the IP of each attached container, and volumes with where each is mounted.

Network and volume membership is read from each container's own settings, since the list endpoints do not report it.

Options

--only <ONLY>
Show only this sectionpossible values: projects, networks, volumes
-a, --all
Include stopped containers

Every command also takes the global options: --json, --color, --icons and --theme.

Examples

$ dok tree  # all three
$ dok tree --only networks  # one section
$ dok tree -a  # include stopped containers

Output

Output of dok tree against the demo stack
Rendered from dok tree --demo, dok’s built-in example stack.

JSON output

$ dok tree --json
{
  "networks": [
    {
      "containers": [],
      "driver": "bridge",
      "name": "bridge",
      "scope": "local",
      "subnet": "172.17.0.0/16"
    },
    {
      "containers": [
        {
          "ip": "172.19.0.4",
          "name": "demo-shop-api-1"
        },
        {
          "ip": "172.19.0.5",
          "name": "demo-shop-web-1"
        },
        {
          "ip": "172.19.0.2",
          "name": "demo-shop-postgres-1"
        },
        {
          "ip": "172.19.0.3",
          "name": "demo-shop-redis-1"
        }
      ],
      "driver": "bridge",
      "name": "demo-shop_default",
      "scope": "local",
      "subnet": "172.19.0.0/16"
    }
  ],
  "projects": [
    {
      "containers": [
        {
          "image": "ghcr.io/demo-shop/api:1.4.2",
          "name": "demo-shop-api-1",
          "service": "api",
          "state": "running"
        },
        {
          "image": "nginx:1.27-alpine",
          "name": "demo-shop-web-1",
          "service": "web",
          "state": "running"
        },
        {
          "image": "postgres:16-alpine",
          "name": "demo-shop-postgres-1",
          "service": "postgres",
          "state": "running"
        },
        {
          "image": "redis:7-alpine",
          "name": "demo-shop-redis-1",
          "service": "redis",
          "state": "running"
        }
      ],
      "name": "demo-shop"
    },
    {
      "containers": [
        {
          "image": "grafana/grafana:11.2.0",
          "name": "metrics-1",
          "service": "grafana",
          "state": "running"
        }
      ],
      "name": "observability"
    }
  ],
  "volumes": [
    {
      "driver": "local",
      "mountpoint": "/var/lib/docker/volumes/demo-shop_pgdata/_data",
      "name": "demo-shop_pgdata",
      "ref_count": 1,
      "size": {
        "bytes": 312000000,
        "human": "312MB"
      },
      "used_by": [
        {
          "container": "demo-shop-postgres-1",
          "destination": "/var/lib/postgresql/data"
        }
      ]
    },
    {
      "driver": "local",
      "mountpoint": "/var/lib/docker/volumes/demo-shop_cache/_data",
      "name": "demo-shop_cache",
      "ref_count": 1,
      "size": {
        "bytes": 3100000,
        "human": "3.1MB"
      },
      "used_by": [
        {
          "container": "demo-shop-redis-1",
          "destination": "/data"
        }
      ]
    }
  ]
}

Longer arrays are cut to their first two elements here.

See also

dok-ps(1), dok-ports(1), dok(7)

dok 0.3.02026-09-27DOK-TREE(1)