DEV Community

DevOps Start
DevOps Start

Posted on • Originally published at devopsstart.com

Docker TUI Dashboard: Manage Containers with Lazydocker

If you keep three terminal tabs open just to run docker ps, docker logs -f,
and docker stats, replace all of them with one screen. Lazydocker
is a terminal UI that puts your containers, images, volumes, and networks in a
single dashboard, with live logs and resource graphs next to the list you are
scrolling. It is a single Go binary, it talks to the same Docker daemon your CLI
already uses, and it needs no config to be useful on the first run.

Install it

Pick whichever fits your setup. All three drop a lazydocker binary on your
PATH:

$ brew install jesseduffield/lazydocker/lazydocker   # macOS or Linuxbrew
$ go install github.com/jesseduffield/lazydocker@latest   # any Go 1.21+ toolchain
$ curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash
Enter fullscreen mode Exit fullscreen mode

Then start it from any directory:

$ lazydocker
Enter fullscreen mode Exit fullscreen mode

If you are inside a Compose project, run it there. Lazydocker reads the
docker-compose.yml in your working directory and adds a project view so you
can restart the whole stack, not just one container.

The layout

The left column is a stack of panels: Project, Containers, Images, Volumes, and
Networks. The right side is the main view, and it reacts to whatever you have
selected on the left. Highlight a container and the main view shows its logs.
Switch the main view's tabs and you get its config, its stats as an ASCII CPU and
memory graph, and its environment. Nothing to configure, no query to type.

Keys worth memorizing

You drive the whole thing from a handful of keys. These are the navigation keys
that never change:

Key Action
1-5 Jump straight to Project, Containers, Images, Volumes, or Networks
[ / ] Cycle the tabs in the main view (logs, stats, config, env)
x Open the action menu for whatever is highlighted
+ / _ Grow or shrink the focused panel
Esc Go back one level
q Quit

The one to lean on is x. Highlight a container, press x, and you get a menu
of everything you can do to it: restart, stop, remove, prune, attach, or exec a
shell. Because the menu is generated from your installed version, it is always
the authoritative list of shortcuts, so you never have to guess whether r
restarts or s stops on the build you have. The common defaults are r to
restart, s to stop, and d to remove, but let the x menu confirm them.

Three things it replaces on day one

Tailing logs across a multi-service app. Select each container and its live log
stream is already in the main view, no docker logs -f <id> and no copying
container IDs.

Cleaning up disk. Press x on the Images panel to prune dangling images, or on a
stopped container to remove it, instead of hunting for the right
docker image prune incantation.

Spotting the container that is eating your CPU. The stats tab draws a live graph
per container, so you see the offender without leaving the dashboard or parsing
docker stats columns.

Configuration, when you want it

Lazydocker writes a config file the first time it runs. On Linux it lands at
~/.config/jesseduffield/lazydocker/config.yml, and on macOS under
~/Library/Application Support. You can rebind keys, change the log tail length,
and add custom commands there, for example a one-key docker compose up -d for
the current project. The defaults are sensible, so treat the config as optional
polish rather than required setup.

When to reach for something else

Lazydocker is aimed at local development, where you are juggling a handful of
containers and want fast feedback. If you only need a live top-style table of
container metrics, ctop is lighter. If you are managing production hosts and
want a web UI with role-based access, that is Portainer's job, not a terminal
dashboard's. For local Docker work, though, lazydocker earns a permanent alias.

For the CLI commands lazydocker wraps, the Docker CLI reference
is the source of truth. If your daemon connection is broken before you even get
this far, start with this GitLab CI Docker daemon fix,
and when you are ready to slim the images you are inspecting, see
Docker multi-stage builds.
If you live on the Kubernetes side too, the same keyboard-first habit pays off in
the kubectl cheat sheet.

Top comments (0)