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.