Skip to content

Lazydocker Cheat Sheet

Overview

Lazydocker is a terminal-based user interface for managing Docker containers and Docker Compose stacks. It provides a visual dashboard for monitoring containers, images, volumes, and networks without needing to remember complex Docker CLI commands. Everything is accessible through keyboard-driven navigation with real-time updates.

Lazydocker displays container status, resource usage (CPU, memory), logs, environment variables, and configuration in a single terminal window. It supports common operations like starting, stopping, restarting, removing containers and images, attaching to shells, and viewing real-time log streams. It works with both standalone Docker containers and Docker Compose projects.

Installation

# macOS via Homebrew
brew install lazydocker

# Linux / macOS via Go
go install github.com/jesseduffield/lazydocker@latest

# Linux one-liner script
curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash

# Arch Linux
sudo pacman -S lazydocker

# Nixpkgs
nix-env -iA nixpkgs.lazydocker

# Scoop (Windows)
scoop install lazydocker

# Chocolatey (Windows)
choco install lazydocker

# Docker (run lazydocker itself in Docker)
docker run --rm -it \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v ~/.config/lazydocker:/.config/jesseduffield/lazydocker \
  lazyteam/lazydocker

Quick Start

# Launch lazydocker
lazydocker

# Launch with a specific Docker Compose file
COMPOSE_FILE=docker-compose.prod.yml lazydocker

# Launch with a specific Docker context
DOCKER_CONTEXT=remote lazydocker

Interface Layout

┌────────────────────────────────────────────────┐
│ Lazydocker                                      │
├──────────┬─────────────────────────────────────┤
│ Left     │ Main Panel                          │
│ Panel    │                                     │
│          │ Shows details for selected item:    │
│ Projects │ - Logs                              │
│ Containers│ - Stats (CPU/Memory)              │
│ Images   │ - Config/Environment               │
│ Volumes  │ - Top (running processes)           │
│ Networks │                                     │
│          │                                     │
└──────────┴─────────────────────────────────────┘

Global Keys

KeyAction
[ / ]Switch between left panel sections
TabSwitch between left and main panels
j / kMove down / up in lists
h / lMove left / right between panels
EnterFocus / select item
qQuit lazydocker
xOpen command menu for selected item
?Show help / keybindings
/Filter items in current list
EscapeCancel / go back
+Next Docker Compose project
-Previous Docker Compose project

Container Panel

KeyAction
dStop container
sStart/restart container
rRestart container
aAttach to container shell
mView logs
EOpen shell in container
DRemove container
SStop container
UStart container
RRebuild and recreate (Compose)
bView bulk commands
cRun custom command

Image Panel

KeyAction
dRemove image
DRemove image (force)
pPrune unused images

Volume Panel

KeyAction
dRemove volume
pPrune unused volumes

Network Panel

KeyAction
dRemove network
pPrune unused networks

Main Panel Tabs

When a container is selected, the main panel shows multiple tabs:

TabContent
LogsReal-time container log stream
StatsCPU, memory, network I/O, disk I/O
ConfigContainer configuration and environment
TopRunning processes inside the container

Log Navigation

KeyAction
j / kScroll down / up
GJump to bottom (latest)
gJump to top (oldest)
Ctrl+DPage down
Ctrl+UPage up
/Search in logs
nNext search match
NPrevious search match
fToggle follow mode
wToggle line wrap
tToggle timestamps
sToggle since filter

Configuration

Config File Location

# Linux
~/.config/lazydocker/config.yml

# macOS
~/Library/Application Support/lazydocker/config.yml

# Windows
%APPDATA%/lazydocker/config.yml

config.yml

gui:
  # Show all containers or just running
  showAllContainers: true

  # Scroll speed
  scrollHeight: 2

  # Language
  language: 'auto'

  # Theme (can be customized)
  theme:
    activeBorderColor:
      - green
      - bold
    inactiveBorderColor:
      - white
    selectedLineBgColor:
      - blue

  # Return to container after executing command
  returnImmediately: false

  # Wrap main panel content
  wrapMainPanel: true

logs:
  # Timestamps in logs
  timestamps: false

  # Number of log lines to show
  since: '60m'

  # Tail last N lines
  tail: ''

commandTemplates:
  # Docker top command
  dockerCompose: "docker compose"
  
  # Stop all containers
  stopAll: "docker stop $(docker ps -q)"
  
  # Remove all stopped containers
  pruneContainers: "docker container prune -f"

# Custom commands available via 'c' key
customCommands:
  containers:
    - name: "View full logs"
      attach: false
      command: "docker logs -f {{ .Container.ID }}"
      serviceNames: []

    - name: "Shell into container"
      attach: true
      command: "docker exec -it {{ .Container.ID }} /bin/sh"
      serviceNames: []

    - name: "View environment"
      attach: false
      command: "docker inspect --format='{{range .Config.Env}}{{println .}}{{end}}' {{ .Container.ID }}"
      serviceNames: []

  images:
    - name: "Show image history"
      command: "docker history {{ .Image.ID }}"
      attach: false

  volumes:
    - name: "Show volume details"
      command: "docker volume inspect {{ .Volume.Name }}"
      attach: false

Custom Commands

Custom commands use Go templates with access to the selected resource.

Available Template Variables

ContextVariables
Container.Container.ID, .Container.Name, .Container.Image
Image.Image.ID, .Image.Repository, .Image.Tag
Volume.Volume.Name, .Volume.Driver
Network.Network.Name, .Network.ID
Service.Service.Name (Docker Compose)

Example Custom Commands

customCommands:
  containers:
    - name: "Copy file from container"
      command: "docker cp {{ .Container.ID }}:/path/in/container ./local/path"
      attach: false

    - name: "Export container"
      command: "docker export {{ .Container.ID }} > {{ .Container.Name }}.tar"
      attach: false

    - name: "View resource usage"
      command: "docker stats {{ .Container.ID }} --no-stream"
      attach: false

    - name: "Inspect container"
      command: "docker inspect {{ .Container.ID }} | less"
      attach: true

Docker Compose Integration

Lazydocker automatically detects Docker Compose projects and provides additional operations:

FeatureDescription
Service groupingContainers grouped by Compose service
RebuildRebuild and recreate services (R key)
Up/DownStart or stop entire Compose project
LogsView logs for specific service or all
Project switchingSwitch between Compose projects with +/-

Advanced Usage

Aliases

# Add to ~/.bashrc or ~/.zshrc
alias lzd='lazydocker'

# Launch for specific Compose project
alias lzd-prod='COMPOSE_FILE=docker-compose.prod.yml lazydocker'

Remote Docker Hosts

# Use Docker context
docker context create remote --docker "host=ssh://user@remote-host"
DOCKER_CONTEXT=remote lazydocker

# Or use DOCKER_HOST environment variable
DOCKER_HOST=ssh://user@remote-host lazydocker
DOCKER_HOST=tcp://remote-host:2376 lazydocker

Filtering

Press / in any list panel to filter items. The filter supports substring matching:

# Filter containers by name
/web

# Filter images
/nginx

# Clear filter
Press Escape

Troubleshooting

IssueSolution
Cannot connect to DockerEnsure Docker daemon is running; check socket permissions
Permission deniedAdd user to docker group: sudo usermod -aG docker $USER
No containers showingCheck showAllContainers config; ensure Docker is running
Slow performanceReduce log history with since config; limit tail lines
Custom commands not appearingCheck config.yml syntax; restart lazydocker
Key bindings not workingCheck for terminal key mapping conflicts
Compose services not detectedRun lazydocker from the Compose project directory
Remote Docker not connectingVerify Docker context or DOCKER_HOST is correct