Lazydocker is an open-source terminal interface for managing your Docker environment. It gives you a powerful control surface for interacting with containers, images, and volumes. Lazydocker makes it quick and easy to inspect Docker objects without repeating lengthy terminal commands.

The standard Docker CLI isn’t designed for always-on monitoring or quick investigation of issues. Finding a problem with a service often requires at least three commands – first listing your containers with docker ps, then interacting with the potential culprit (docker restart ), and finally checking the change has been effective by repeating docker ps. Lazydocker lets you perform this sequence from a single screen while you continually monitor logs and activity.

Lazydocker wraps much of the docker CLI’s functionality into an auto-updated terminal UI (TUI). You can monitor all the containers and services running on your Docker host in one terminal window. It includes real-time resource usage graphs, image layer inspection tools, and quick actions for stopping, restarting, and pruning your objects.

Installing Lazydocker

Lazydocker is available for Linux, macOS, and Windows through several different channels. It’s present in the Homebrew and Chocolatey package managers or can be downloaded directly from the project’s GitHub Releases page.

The official installation script is the easiest way to get started on a Linux system. This will download the correct binary for your platform and deposit it into your $HOME/.local/bin directory.

Run lazydocker –version to check your installation’s working:

Using Lazydocker

Run the lazydocker command without any arguments to launch the Lazydocker TUI.

 

 

The screen is divided into two horizontal panes. The left side lets you switch between different Docker objects such as containers, images, and volumes. The right pane is used to monitor and interact with the currently selected object.

The active object is highlighted in brighter text. Use the up/down arrow keys to move between items in the focused pane. The right/left arrow keys move the focus between different panes. If you’re in the Containers pane, pressing the right arrow key will move you to the Images pane below, for example. Pressing enter always focuses the right pane. You can also move between panes and objects by clicking them with your mouse in compatible shells.

Help’s always available when you’re using Lazydocker; pressing the x key will display a keyboard shortcut reference.

Working With Containers

The Containers pane is where you’ll usually spend most of your time. Only running containers are shown by default; pressing the e key will include stopped and hidden ones too. Each container displays its current CPU consumption next to its name.

Selecting a container defaults to displays its logs on the right side of the screen. Don’t be concerned if no logs are shown to begin with: Lazydocker only prints lines written during the last hour, to prevent excessive resource consumption.

Other panes of information are available from the tab strip at the top of the screen. Either click the tabs or use the [ and ] keys to move between them.

The Stats tab provides live graphs of the container’s CPU and memory consumption. Scrolling down the pane provides further information about network ingress and egress, as well as the complete stats output produced by the Docker daemon. Any of these metrics can be graphed by customizing your Lazydocker configuration.

 

The Env tab offers a simple key-value listing of the environment variables set in the container. Config provides detailed information about the container, including its labels and the JSON output from docker inspect. The final Top pane shows the processes running inside the container.

You can perform the following actions against containers by selecting them and then pressing a key:

r – Restarts the container. s – Stops the container. A confirmation prompt is shown. d – Removes the container. A confirmation prompt is shown. E – Launches a new shell inside the container. This takes you out of the Lazydocker interface. You’ll be returned automatically when you drop out of the container shell and then press the enter key.

Performing Bulk Container Actions

Lazydocker includes a few bulk actions that target multiple containers simultaneously. Press the b key to view the menu and select an option:

The facility lets you stop and remove several containers in one operation. This helps you quickly restore a clean slate when you’re experimenting with different containers and images.

Adding Custom Stats Graphs

Lazydocker supports arbitrary stats graphs using any metric reported by Docker. Scroll down the Stats pane to see the stats JSON produced by the Docker daemon. Find a value to graph and make note of its position in the JSON object structure, such as ClientStats.networks.eth0.rx_bytes. This metric records the network traffic received by the container.

Open your Lazydocker config file by selecting the Project pane and then pressing the o key. You can reached the file directly from your filesystem too – you’ll usually find it at ~/.config/lazydocker/config.yml on Linux. Add the following content to the file:

Restart Lazydocker and then head to a container’s stats. You should see incoming network bandwidth is now graphed in addition to the default memory and CPU consumption metrics. Take care that the statPath field in your config file needs to be converted to consistent camel case as shown above.

 

Working With Images

The Images section displays information about each image you select. The right pane provides a synopsis of the image’s name, ID, tags, and size. It then lists all the layers within their image, including their size and the command that created them.

Pressing the d key will display a prompt that lets you delete the selected image. The bulk actions menu accessed with b provides an option for cleaning up all the unused images that exist on your host.

Working With Volumes

The Volumes section has similar functionality to Images. Information about the selected volume is shown in the right pane, including its mount point, labels, and active storage driver. Pressing d lets you delete the volume while the bulk actions menu b provides an option that removes all unused volumes.

Lazydocker and Docker Compose

Lazydocker has good integrated support for Docker Compose projects. Launching Lazydocker from a directory that contains a docker-compose.yml file will present an altered version of the interface that groups your containers into “Services” and “Standalone Containers” panes. Services shows the containers defined by your Docker Compose config; Standalone Containers represents all the other containers running on your host.

The Compose UI layout also enables extra features in the Project pane at the top-left of the screen. Moving the focus to this pane will show the combined logs from all the services in your Compose stack on the right. Another tab, “Docker-Compose Config,” displays the contents of your docker-compose.yml file.

Summary

Lazydocker is a versatile tool for Docker power users. It provides a centralized view of your container environment within a single terminal window.

Whereas most Docker UIs are web- or desktop-based, Lazydocker sticks to the simplicity of a terminal experience. This makes it a great choice for people who like the style of CLIs but don’t want to remember and repeat hand-typed commands. Lazydocker is a standalone binary that runs on your host so it’s easy to deploy and set up. It also avoids the security concerns of using a web app to interact with Docker.