lazydocker¶
lazydocker is a terminal UI for Docker, providing a visual interface for managing containers, images, volumes, and networks.
Installation¶
macOS (Homebrew)¶
Linux¶
# Download binary
curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash
# Or via package managers
# Arch Linux
pacman -S lazydocker
# Via Go
go install github.com/jesseduffield/lazydocker@latest
Verify Installation¶
Basic Usage¶
Launch¶
Interface Layout¶
+------------------+----------------------------------+
| Containers | Main Panel |
| (1) | (Logs/Stats/Config/Top) |
+------------------+ |
| Images | |
| (2) | |
+------------------+ |
| Volumes | |
| (3) | |
+------------------+ |
| Networks | |
| (4) | |
+------------------+----------------------------------+
Navigation¶
| Key | Action |
|---|---|
| H / L | Switch panels |
| J / K | Move up/down |
| Enter | Focus main panel |
| Esc | Return to list |
| [ / ] | Scroll main panel |
| ? | Show keybindings |
Containers¶
Container List¶
The containers panel shows all containers with status indicators:
- Green: Running
- Yellow: Paused
- Red: Stopped/Exited
- Gray: Created
Container Actions¶
| Key | Action |
|---|---|
| D | Stop container |
| S | Start/stop toggle |
| R | Restart |
| A | Attach to container |
| Shift+D | Remove container |
| E | Exec shell in container |
| Shift+E | Exec custom command |
| L | View logs |
| C | Run docker-compose |
| Enter | View details |
View Logs¶
- Select container
- Press L or view in main panel
- Use [ / ] to scroll
Log options in main panel:
| Key | Action |
|---|---|
| Ctrl+F | Follow logs |
| Ctrl+S | Search logs |
| T | Toggle timestamps |
| W | Wrap lines |
Container Shell¶
- Select container
- Press E for shell access
- Press Ctrl+D or ++exit++ to return
Container Stats¶
Select container and view in main panel:
- CPU usage
- Memory usage
- Network I/O
- Block I/O
Toggle views with 1 - 4 when container selected.
Images¶
Image Actions¶
| Key | Action |
|---|---|
| D | Delete image |
| Shift+D | Force delete |
| Enter | View layers |
| B | Build from Dockerfile |
| P | Push to registry |
| F | Filter images |
Prune Images¶
Press P in images panel for prune options:
- Prune dangling images
- Prune all unused images
Volumes¶
Volume Actions¶
| Key | Action |
|---|---|
| D | Delete volume |
| Enter | View details |
| P | Prune unused volumes |
Volume Info¶
View in main panel:
- Mount point
- Size
- Created date
- Associated containers
Networks¶
Network Actions¶
| Key | Action |
|---|---|
| D | Delete network |
| Enter | View details |
| P | Prune unused networks |
Network Info¶
- Subnet/Gateway
- Connected containers
- Driver type
Docker Compose¶
Running Compose Commands¶
- Press M for menu
- Select compose action
Or use direct keys:
| Key | Action |
|---|---|
| U | Compose up |
| Shift+U | Compose up --build |
| Shift+D | Compose down |
| R | Compose restart |
Project View¶
lazydocker automatically detects docker-compose projects and groups containers.
Main Panel Views¶
Toggle with number keys when container selected:
| Key | View |
|---|---|
| 1 | Logs |
| 2 | Stats |
| 3 | Config (inspect) |
| 4 | Top (processes) |
Configuration¶
Config File Location¶
Example Configuration¶
gui:
scrollHeight: 2
theme:
activeBorderColor:
- green
- bold
inactiveBorderColor:
- white
returnImmediately: false
showAllContainers: true
logs:
timestamps: false
since: '60m'
tail: 200
commandTemplates:
dockerCompose: docker compose
restartService: '{{ .DockerCompose }} restart {{ .Service.Name }}'
oS:
openCommand: open {{filename}}
openLinkCommand: open {{link}}
stats:
graphs:
- caption: CPU (%)
statPath: DerivedStats.CPUPercentage
color: cyan
- caption: Memory (%)
statPath: DerivedStats.MemoryPercentage
color: green
Custom Commands¶
customCommands:
containers:
- name: "View container IP"
attach: false
command: "docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' {{ .Container.ID }}"
- name: "Export logs"
attach: false
command: "docker logs {{ .Container.ID }} > /tmp/{{ .Container.Name }}.log 2>&1"
images:
- name: "Scan for vulnerabilities"
command: "docker scout cves {{ .Image.ID }}"
Bulk Operations¶
Select Multiple Items¶
| Key | Action |
|---|---|
| Space | Toggle selection |
| Ctrl+A | Select all |
| D | Delete selected |
Prune All¶
Press Shift+P for system prune options.
Search and Filter¶
| Key | Action |
|---|---|
| / | Start filter |
| Esc | Clear filter |
Filter syntax:
# Filter by name
nginx
# Filter by status
status:running
status:exited
# Filter by label
label:env=prod
Keybinding Reference¶
Global¶
| Key | Action |
|---|---|
| ? | Help |
| X | Menu |
| M | Docker menu |
| Q | Quit |
| Esc | Cancel/back |
Containers¶
| Key | Action |
|---|---|
| S | Stop/start |
| D | Stop |
| R | Restart |
| E | Exec shell |
| A | Attach |
| L | Logs |
| Shift+D | Remove |
| B | Bulk actions |
All Panels¶
| Key | Action |
|---|---|
| D | Delete |
| P | Prune |
| F | Filter |
| Enter | Details |
Common Workflows¶
Quick Container Management¶
- Launch:
lazydocker - Navigate to container: J / K
- View logs: 1 or L
- Shell access: E
Clean Up Resources¶
- Press M for menu
- Select "Prune containers"
- Or use P in volumes/images for specific cleanup
Monitor Container¶
- Select container
- Press 2 for stats
- Watch CPU/memory in real-time
Troubleshoot Container¶
- Select container
- View logs: 1
- Search logs: Ctrl+S
- Check config: 3
- Shell in: E
Editor Integration¶
Neovim¶
-- Custom keymap for lazydocker
vim.keymap.set("n", "<leader>D", function()
require("toggleterm").exec("lazydocker")
end, { desc = "lazydocker" })
VS Code Task¶
{
"label": "lazydocker",
"type": "shell",
"command": "lazydocker",
"presentation": {
"reveal": "always",
"panel": "dedicated"
}
}
Recommended Aliases¶
Troubleshooting¶
Permission Denied¶
Ensure user is in docker group:
Docker Socket¶
If using custom socket: