What it is
LazyDocker is a terminal UI for Docker and Kubernetes, providing a quick overview and management of containers, images, volumes, networks, and more.
Installation
Linux
sudo apt-get update && sudo apt-get install lazy-docker
# Or using Homebrew
brew install lazy-docker
macOS
brew install lazy-docker
Windows
LazyDocker is not directly installable on Windows. The recommended approach is to use the Windows Subsystem for Linux (WSL) and follow the Linux installation instructions within your WSL distribution.
Core Concepts
- Containers: Running instances of Docker images. LazyDocker allows you to view, start, stop, restart, remove, and prune containers.
- Images: Read-only templates used to create containers. LazyDocker lets you list, pull, remove, and prune images.
- Volumes: Persistent storage for Docker containers. LazyDocker helps manage volumes, including creating, removing, and inspecting them.
- Networks: Virtual networks that containers can connect to. LazyDocker shows available networks and allows their management.
- Services (Docker Swarm): Managed applications running as a set of tasks. LazyDocker provides an overview of services and their state.
- Pods (Kubernetes): The smallest deployable units in Kubernetes, representing a group of one or more containers. LazyDocker displays pods, their status, and associated events.
- Deployments (Kubernetes): Objects that describe the desired state for Pods and ReplicaSets. LazyDocker shows deployment status and allows scaling.
- Nodes (Kubernetes): The machines (physical or virtual) that run your cluster. LazyDocker displays node status and resource utilization.
Commands / Usage
LazyDocker is primarily navigated and controlled via its interactive interface. The following are key bindings and actions within the UI:
General Navigation and Actions
?: Show help menu with keybindings.Ctrl+W: Close current tab.Ctrl+N: Open a new tab.Ctrl+L: Refresh all data.Tab: Switch between panels (e.g., containers list, logs, details).Up/Down Arrow: Navigate lists.Enter: Select an item or open a subcommand.q: Quit LazyDocker.:: Enter command mode for executing shell commands.
Docker Contexts
c: Show Docker containers.i: Show Docker images.v: Show Docker volumes.n: Show Docker networks.s: Show Docker Swarm services.d: Show Docker daemon logs.k: Show Kubernetes contexts.
Kubernetes Contexts
p: Show Kubernetes pods.d: Show Kubernetes deployments.s: Show Kubernetes services.n: Show Kubernetes namespaces.no: Show Kubernetes nodes.po: Show Kubernetes persistent volume claims (PVCs).ev: Show Kubernetes events.sec: Show Kubernetes secrets.ing: Show Kubernetes ingress.
Container Management (when viewing containers)
r: Restart selected container.s: Stop selected container.t: Start selected container.k: Kill selected container.rm: Remove selected container.a: Attach to selected container.l: View logs for selected container.e: Execute command in selected container.cp: Copy files to/from selected container.ex: Execute command in selected container.
Image Management (when viewing images)
rmi: Remove selected image.pull: Pull selected image.prune: Remove unused images.
Volume Management (when viewing volumes)
rm: Remove selected volume.prune: Remove unused volumes.
Network Management (when viewing networks)
rm: Remove selected network.
Kubernetes Pod Management (when viewing pods)
rm: Delete selected pod.l: View logs for selected pod.exec: Execute command in a pod.describe: Show detailed description of the pod.
Kubernetes Deployment Management (when viewing deployments)
scale: Scale selected deployment.restart: Restart selected deployment.delete: Delete selected deployment.
Common Patterns
Quick Restart of a specific Docker container:
- Open LazyDocker:
lazydocker - Press
cto view containers. - Navigate to the desired container using arrow keys.
- Press
rto restart it.
Executing a command inside a running Docker container:
- Open LazyDocker:
lazydocker - Press
cto view containers. - Navigate to the desired container.
- Press
eto open the command execution prompt. - Type the command (e.g.,
ls -l /app) and pressEnter.
Viewing logs of a Kubernetes pod:
- Open LazyDocker:
lazydocker - Press
pto view pods. - Navigate to the desired pod.
- Press
lto view its logs. Use arrow keys to scroll.
Pruning unused Docker images:
- Open LazyDocker:
lazydocker - Press
ito view images. - Press
Shift+P(orPdepending on version/configuration) to prune unused images.
Scaling a Kubernetes deployment:
- Open LazyDocker:
lazydocker - Press
dto view deployments. - Navigate to the desired deployment.
- Press
sto open the scaling prompt. - Enter the new replica count and press
Enter.
Gotchas
- Context Switching: LazyDocker often defaults to the
dockercontext. If you’re working with Kubernetes, ensure you’ve switched to the correct Kubernetes context either before launching LazyDocker or by using the Kubernetes context switching options within the UI. - Permissions: On some Linux systems, you might need to run
lazydockerwithsudoif your user is not part of thedockergroup. However, it’s generally recommended to add your user to thedockergroup for easier access:sudo usermod -aG docker $USER. You’ll need to log out and log back in for this change to take effect. - Kubernetes Resource Limits: LazyDocker displays Kubernetes resources, but it doesn’t magically bypass resource limits or quotas defined in your cluster.
- Keybinding Conflicts: If you’re using a terminal multiplexer like
tmuxorscreen, some keybindings might conflict. You may need to configure LazyDocker or your multiplexer to avoid these conflicts. - Performance with Many Resources: If you have a very large number of containers, images, or Kubernetes resources, LazyDocker might take longer to load and display data initially.