docker.recipes

Lazydocker Terminal UI

beginner

Terminal-based Docker management with ncurses interface.

Overview

Lazydocker is a terminal-based user interface built by Jesse Duffield that transforms Docker container management from complex CLI commands into an intuitive, ncurses-driven experience. This TUI application provides real-time monitoring, log viewing, and container interaction through a keyboard-driven interface that displays container stats, images, volumes, and networks in organized panels. Unlike traditional Docker management tools that require memorizing numerous commands or switching between web interfaces, lazydocker consolidates everything into a single, responsive terminal application. This stack combines lazydocker with Redis 7 and PostgreSQL 15 to create a practical demonstration environment where you can experience managing real database services through the terminal interface. The Redis instance provides fast in-memory caching capabilities while PostgreSQL delivers robust relational database functionality, giving you two distinctly different service types to monitor, restart, and troubleshoot using lazydocker's streamlined interface. This combination showcases how lazydocker handles both lightweight Alpine-based containers and more complex database services with different resource requirements and startup behaviors. Developers working with multi-container applications, system administrators managing development environments, and DevOps engineers who prefer terminal-based workflows will find this stack particularly valuable. The setup eliminates the need to constantly run 'docker ps', 'docker logs', and 'docker exec' commands by providing visual container health monitoring, one-key log access, and instant shell access to running containers. This makes it ideal for debugging application issues, monitoring resource usage during development, and teaching Docker concepts through a more accessible interface than raw CLI commands.

Key Features

  • Real-time container CPU, memory, and network I/O statistics display with visual graphs
  • Split-pane log viewing with automatic scrolling and search functionality across multiple containers
  • One-key container actions: restart, stop, remove, and shell access without typing docker commands
  • Docker socket mounting enables full Docker daemon access for complete container lifecycle management
  • Persistent lazydocker configuration storage for custom keybindings and display preferences
  • Multi-service monitoring dashboard showing Redis connection stats and PostgreSQL process information
  • Keyboard-driven navigation with vim-like controls for rapid container switching and management
  • Container inspection views displaying environment variables, port mappings, and volume mounts

Common Use Cases

  • 1Local development environment monitoring where developers need to quickly check database connection status and application logs
  • 2Database administration tasks requiring frequent PostgreSQL container restarts and Redis cache clearing during development cycles
  • 3Docker learning environments where students can visually understand container relationships without memorizing CLI syntax
  • 4Troubleshooting microservice applications by simultaneously monitoring Redis cache hit rates and PostgreSQL query performance
  • 5Development team demonstrations showing container health status and real-time log output during application testing
  • 6CI/CD pipeline debugging where engineers need to quickly inspect container states and logs after deployment failures
  • 7Homelab container management for users running personal Redis and PostgreSQL instances who prefer terminal interfaces over web UIs

Prerequisites

  • Docker Engine with Unix socket access at /var/run/docker.sock for lazydocker container communication
  • Minimum 1GB RAM available for PostgreSQL container plus 256MB for Redis and lazydocker operations
  • Terminal with ncurses support and minimum 80x24 character display for proper lazydocker interface rendering
  • Basic familiarity with keyboard navigation and vim-style controls for efficient lazydocker usage
  • Available ports 6379 for Redis external access if connecting applications outside the Docker network
  • Docker Compose v2.0+ for proper service dependency handling and volume management

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 lazydocker:
3 image: lazyteam/lazydocker:latest
4 stdin_open: true
5 tty: true
6 volumes:
7 - /var/run/docker.sock:/var/run/docker.sock
8 - lazydocker_config:/root/.config/lazydocker
9 network_mode: bridge
10
11 # Sample services to manage
12 redis:
13 image: redis:7-alpine
14 ports:
15 - "6379:6379"
16
17 postgres:
18 image: postgres:15-alpine
19 environment:
20 - POSTGRES_PASSWORD=example
21
22volumes:
23 lazydocker_config:

.env Template

.env
1# Lazydocker
2# Run: docker compose run lazydocker
3# Terminal UI for Docker management

Usage Notes

  1. 1Run: docker compose run lazydocker
  2. 2Terminal-based UI
  3. 3Navigate with arrow keys
  4. 4View logs, stats, exec into containers
  5. 5Keyboard shortcuts for common actions

Individual Services(3 services)

Copy individual services to mix and match with your existing compose files.

lazydocker
lazydocker:
  image: lazyteam/lazydocker:latest
  stdin_open: true
  tty: true
  volumes:
    - /var/run/docker.sock:/var/run/docker.sock
    - lazydocker_config:/root/.config/lazydocker
  network_mode: bridge
redis
redis:
  image: redis:7-alpine
  ports:
    - "6379:6379"
postgres
postgres:
  image: postgres:15-alpine
  environment:
    - POSTGRES_PASSWORD=example

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 lazydocker:
5 image: lazyteam/lazydocker:latest
6 stdin_open: true
7 tty: true
8 volumes:
9 - /var/run/docker.sock:/var/run/docker.sock
10 - lazydocker_config:/root/.config/lazydocker
11 network_mode: bridge
12
13 # Sample services to manage
14 redis:
15 image: redis:7-alpine
16 ports:
17 - "6379:6379"
18
19 postgres:
20 image: postgres:15-alpine
21 environment:
22 - POSTGRES_PASSWORD=example
23
24volumes:
25 lazydocker_config:
26EOF
27
28# 2. Create the .env file
29cat > .env << 'EOF'
30# Lazydocker
31# Run: docker compose run lazydocker
32# Terminal UI for Docker management
33EOF
34
35# 3. Start the services
36docker compose up -d
37
38# 4. View logs
39docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/lazydocker-cli/run | bash

Troubleshooting

  • Permission denied accessing Docker socket: Add your user to the docker group with 'sudo usermod -aG docker $USER' and restart your session
  • Lazydocker interface appears garbled or truncated: Increase terminal size to at least 100x30 characters and ensure TERM environment variable is properly set
  • PostgreSQL container fails to start with 'database system was interrupted': Remove the postgres data volume with 'docker volume rm' and recreate the container
  • Redis connection refused errors in logs: Check that port 6379 isn't already in use by another Redis instance with 'netstat -tlnp | grep 6379'
  • Lazydocker shows no containers or services: Verify Docker daemon is running and socket permissions allow access with 'docker ps' command outside lazydocker
  • Container stats showing zero or incorrect values: Restart the Docker daemon and recreate lazydocker container to refresh metric collection

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Ad Space