Lazy Docker: A User-Friendly CLI Tool for Docker Management

Linux TLDR
Last Updated:
Reading time: 4 minutes
🚀
Quick Overview

If you need a lightweight alternative to Portainer, consider Lazy Docker. It’s a CLI Docker front-end that displays the list of running/stopped containers, images, volumes, and networks and allows you to check their logs, stats, env, config, and top.

However, complex operations on containers, such as attaching flags or tags, assigning ports, advanced networking configurations, and building images, cannot be done (click here to know more).

Lazy docker text user interface

Lazy Docker, a minimalist CLI tool (unlike the advanced Portainer Web UI), is highly beneficial for Docker users who primarily focus on monitoring containers, images, volumes, and networks.

It provides a more interactive and user-friendly way to interact with Docker compared to the standard command-line interface (CLI).

Lazy Docker simplifies Docker container management with a visual interface, but it’s not a substitute for the standard Docker CLI or advanced front-ends like Portainer.

In this article, you’ll discover its features along with its limitations, the installation process on Linux, and beginner-friendly usage instructions.

Tutorial Details

DescriptionLazy Docker
Difficulty LevelModerate
Root or Sudo PrivilegesYes
OS CompatibilityUbuntu, Manjaro, Fedora, etc.
Prerequisitesdocker
Internet RequiredYes (for installation)

Features and Limitations of Lazy Docker

Lazy Docker could become your preferred Docker management tool if your primary requirements align with the following:

  • Quickly view the list of running/stopped containers, images, volumes, and networks.
  • Instantly track your container’s resource utilization (CPU, memory) and view live logs through real-time monitoring.
  • Easily manage containers using Lazy Docker’s user-friendly interface for starting, stopping, restarting, and removing them.
  • Support Docker Compose for easy management of multi-container applications defined in Compose files.
  • Launch a terminal session inside a running container directly from the LazyDocker interface.
  • Provides time-saving keyboard shortcuts for Docker commands, enhancing efficiency for power users.

Despite its many features, LazyDocker has limitations and may not excel at all Docker management tasks. Here are some things it cannot do or may not perform well in:

  • It lacks robust support for orchestrating containers using Docker Swarm or Kubernetes.
  • Advanced networking setups, such as custom bridge networks with complex routing, may necessitate the use of the standard Docker CLI since they cannot be configured here.
  • It isn’t meant for creating Docker images from Dockerfiles or other sources.
  • It doesn’t provide extensive tools for managing user accounts and permissions within running containers.
  • If you rely on Docker plugins for additional functionality, such as storage or network drivers, managing those plugins would generally require the standard Docker CLI.
  • It is best suited for single-host Docker setups; for distributed or multi-host Docker environments like Docker Swarm or Kubernetes clusters, different tools and configurations are needed.

Despite these limitations, if your requirements align with the features, you can give it a try.

How to Install Lazy Docker on Linux

Lazy Docker isn’t in the Linux repository but offers straightforward installation options for Linux, macOS, and even Windows.

To begin, choose one of the preferred methods for installing it on your Linux system.

Installing Lazy Docker using Homebrew

First, confirm that you have homebrew installed on your system, and then proceed by running this command:

$ brew install jesseduffield/lazydocker/lazydocker

Installing Lazy Docker using Go

Ensure Golang is installed on your system, then run this command:

$ go install github.com/jesseduffield/lazydocker@latest

Installing Lazy Docker using Curl

Binary files are available on the release page for manual installation, but automation can be achieved with this command:

📝
This command is compatible with both macOS and Windows systems.
$ curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash

By default, the script downloads the binary to “$HOME/.local/bin“. To make it globally accessible, create a symbolic link in the user directory with the following command:

📝
Replace the path of the home directory with your own.
$ sudo ln -s /home/linuxtldr/.local/bin/lazydocker /usr/bin/

Installing Lazy Docker in Arch Linux

You can install lazydocker using the AUR by running:

$ yay -S lazydocker

Strip the Lazy Docker Command (optional)

Create an “lzd” alias to shorten the length of the “lazydocker” command.

📝
When users who aren’t in the Docker group try to use Docker and Lazydocker with “sudo” for their commands, this method usually fails because they relies on the Root configuration file.
#For Bash
$ echo "alias lzd='lazydocker'" >> ~/.bashrc

#For ZSH
$ echo "alias lzd='lazydocker'" >> ~/.zshrc

Usage of Lazy Docker

Once you’ve successfully installed Lazy Docker, use this command to launch it:

$ lazydocker

#OR

$ lzd #If alias is created

Output:

launching lazydocker for the first time

When Lazy Docker is launched, you’ll use the interface displayed in the image above.

Let’s understand each section of this interface, starting with:

  1. Project will be the hostname of your Linux system (equivalent to “hostname“).
  2. Containers will list container names, running or exited status, resource utilization, and forwarded ports (equivalent to “docker ps -a“).
  3. Logs show the chosen container logs (equivalent to “docker logs {container_name}“).
  4. Stats show the live stream of container resource usage statistics in ascii graphs (equivalent to “docker stats {container_name}“).
  5. Env shows the chosen container environment variables (equivalent to “docker inspect {container_name} --format "{{.Config.Env}}“).
  6. Config displays concise container information, with an option for full details (equivalent to “docker inspect {container_name}“).
  7. Top displays the running process within the container (equivalent to “docker top {container_name}“).
  8. Images display saved Docker images in your system (equivalent to “docker images“).
  9. Volumes show container-created volumes (equivalent to “docker volume ls“).
  10. Networks show all available Docker networks (equivalent to “docker network ls“).
  11. Help section displays keyboard shortcuts for scrolling, quitting, menu navigation, and more.

Watch the following video to get an idea of how each section will appear.

If you are in the Config section of any container, you can navigate through the long list of configuration details via the navigation keys or “PgUp/PgDn” key.

To manage containers, images, volumes, and networks, press “b” for bulk editing, then select the desired action based on your needs.

Managing container using bulk editing

Pressing the “x” key displays key bindings for various actions in Lazy Docker.

Displaying the lazy docker key binding

With this key binding, you can easily perform actions on your containers. For example, to restart a specific container, just select it and press “r“.

Restarting docker container using shortcut key

To open a shell for a particular container, select it and press “E” to launch a shell.

📝
If the selected container lacks a valid login shell such as bash or shell, using this shortcut key may result in an error.
Launching shell session for the selected container

The rest is self-explanatory; I’ll let you discover those treasures on your own.

If you encounter any problems or have questions about this article, please feel free to ask them in the comments.

Till then, peace!

Join The Conversation

Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.