dtree

command module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 9 Imported by: 0

README

dtree

A terminal UI that lists your Docker containers grouped by Compose project. Expand a project to see its containers, then open their logs, inspect them or open a shell, all with vim keys or the arrow keys.

  • Containers are grouped by the com.docker.compose.project label; containers outside Compose are listed under (standalone).
  • The list updates live from Docker's event stream.
  • An info panel below the list shows details for the selected container (image, status, ports) or project (directory, compose file, ports, networks, volumes).
  • Logs and inspect open in a built-in viewer with search, follow and line wrap. Inspect output is shown as YAML.
  • Quick commands: press x on a container, type a shell command and its output streams into a popup, with progress bars updating in place. Close the popup and the command keeps running; the container's row shows whether it is still running (⟳), succeeded (✓), failed (✗) or was stopped (■), and X brings the output back. ctrl+c in the popup stops a running command; press it again to kill a command that ignores it. When a command asks for input, press i to switch the popup to input mode: every key goes to the command until esc switches back to scrolling. Commands run with sh -c in a terminal, but the popup only shows their output line by line, so run full-screen programs (vim, top) with ctrl+o instead of enter: the command gets the whole terminal and dtree comes back after it ends and you press enter. ctrl+t does the same, then opens a shell in the container. Quitting dtree stops commands that are still running.
  • The command prompt suggests commands as you type: the ones run this session (most recent first) and your saved commands (★). Pick one with ↑/↓, or press tab to complete it and edit it first. ctrl+s saves the command in the prompt, or forgets it if it is already saved.

Saved commands

Saved commands are kept in ~/.config/dtree/commands.yaml (or $XDG_CONFIG_HOME/dtree/commands.yaml) and are suggested in every container. You can also edit the file by hand:

global:
  - df -h
  - ps aux

Install

Requires Go and the docker CLI.

go install github.com/sebastianmorch/dtree@latest

The binary is installed to $(go env GOPATH)/bin (usually ~/go/bin). Make sure that directory is on your PATH:

export PATH="$HOME/go/bin:$PATH"

Usage

dtree          # running containers
dtree -a       # all containers, including stopped ones
dtree -f shop  # start filtered to containers or projects matching "shop"
dtree --version

The filter from -f / --filter works like typing it after /: press esc to clear it. This makes it easy to keep an alias for a filter you use often:

alias dshop='dtree -a -f shop'

dtree connects to the daemon in DOCKER_HOST or, if that is unset, the current docker context (Docker Desktop, OrbStack, Colima, …).

Keys

Press ? inside dtree for this list.

Tree
Key Action
j / ↓, k / ↑ next / previous row
l / → expand project
h / ← collapse project / go to parent
enter toggle project · shell on container
space toggle project · logs on container
g / G top / bottom
/ or f filter by container or project name
esc clear filter
L logs
i inspect
s shell (bash, falls back to sh)
x run a command (output in a popup; ↑/↓ for recent and saved commands)
X show the last command's output
a toggle running / all containers
r refresh
q / ctrl+c quit
Logs, inspect & command output
Key Action
j / k, ↓ / ↑ scroll
ctrl+d / ctrl+u half page down / up
g / G top / bottom (G resumes follow)
/, n, N search, next, previous
f toggle follow (logs, output)
t toggle timestamps (logs)
r refresh (inspect)
w toggle line wrap
q / esc back · close popup
ctrl+c stop the running command (popup); again to kill it
i type into the running command (popup); esc goes back to scrolling
Command prompt
Key Action
↑ / ↓ pick a recent or saved (★) command
tab complete the highlighted (or first) suggestion to edit it
ctrl+s save the command · forget a saved one
ctrl+u clear
enter / esc run / cancel
ctrl+o run in the terminal (for top, vim, REPLs)
ctrl+t run in the terminal, then open a shell

Development

go run .        # run from source
go test ./...

License

MIT

Documentation

Overview

Command dtree shows Docker containers grouped by compose project, with vim-style navigation, a log viewer, inspect and shell access.

Directories

Path Synopsis
internal
config
Package config reads and writes dtree's settings file.
Package config reads and writes dtree's settings file.
docker
Package docker wraps the Docker Engine SDK behind a small interface the UI depends on, so the UI can be tested with a fake.
Package docker wraps the Docker Engine SDK behind a small interface the UI depends on, so the UI can be tested with a fake.
tree
Package tree groups containers into projects and tracks the cursor and expand/collapse state of the project/container tree.
Package tree groups containers into projects and tracks the cursor and expand/collapse state of the project/container tree.
ui
Package ui is the Bubble Tea interface: a project/container tree plus full-screen log and inspect viewers.
Package ui is the Bubble Tea interface: a project/container tree plus full-screen log and inspect viewers.

Jump to

Keyboard shortcuts

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