Self-Hosting Glances with Docker Compose
What Is Glances?
Glances is a cross-platform system monitoring tool that displays CPU, memory, disk, network, and process metrics in a single real-time dashboard. It replaces the need to juggle htop, iotop, nload, and docker stats by combining everything into one view. The web UI makes it accessible from any browser, and the built-in REST API enables integrations with Grafana, InfluxDB, and Prometheus.
Prerequisites
- A Linux server (Ubuntu 22.04+ recommended)
- Docker and Docker Compose installed (guide)
- 256 MB of free RAM (Glances is lightweight)
- A domain name (optional, for remote access)
Docker Compose Configuration
Create a docker-compose.yml file:
services:
glances:
image: nicolargo/glances:4.5.2
container_name: glances
restart: unless-stopped
pid: host
environment:
- GLANCES_OPT=-w
- TZ=UTC
ports:
- "61208:61208"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /etc/os-release:/etc/os-release:ro
Key configuration choices:
| Setting | Purpose |
|---|---|
pid: host | Required — lets Glances see all host processes, not just container processes |
GLANCES_OPT=-w | Starts the web UI server on port 61208 |
docker.sock mount | Enables Docker container monitoring (CPU, memory, network per container) |
/etc/os-release mount | Shows the host OS name instead of Alpine Linux (the container’s OS) |
Start the stack:
docker compose up -d
Initial Setup
- Open
http://your-server-ip:61208in a browser - The dashboard loads immediately — no account creation or configuration wizard
- The web UI auto-refreshes every 3 seconds by default
The dashboard shows:
- System info — hostname, uptime, OS
- CPU — per-core usage, load average, steal time
- Memory — RAM and swap usage
- Disk I/O — read/write rates per disk
- Network — bandwidth per interface
- File systems — mount point usage
- Processes — sorted by CPU or memory, with PID and command
- Docker containers — resource usage per container (if docker.sock is mounted)
Configuration
Enable Password Authentication
By default, the web UI has no authentication. Add password protection:
environment:
- GLANCES_OPT=-w --password
On first start with --password, Glances generates a password and prints it to the logs:
docker compose logs glances | grep password
To set a specific password, create a password file:
# Create the password file
echo "your-password" > glances.pwd
# Mount it in the container
services:
glances:
image: nicolargo/glances:4.5.2
container_name: glances
restart: unless-stopped
pid: host
environment:
- GLANCES_OPT=-w --password
- TZ=UTC
ports:
- "61208:61208"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /etc/os-release:/etc/os-release:ro
- ./glances.pwd:/root/.config/glances/glances.pwd
Full Network Monitoring
Bridge networking limits network interface visibility. For complete network stats:
services:
glances:
image: nicolargo/glances:4.5.2
container_name: glances
restart: unless-stopped
pid: host
network_mode: host
environment:
- GLANCES_OPT=-w
- TZ=UTC
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /etc/os-release:/etc/os-release:ro
With network_mode: host, remove the ports: section — port 61208 is exposed directly on the host.
Nvidia GPU Monitoring
services:
glances:
image: nicolargo/glances:4.5.2-full
container_name: glances
restart: unless-stopped
pid: host
environment:
- GLANCES_OPT=-w
- TZ=UTC
ports:
- "61208:61208"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /etc/os-release:/etc/os-release:ro
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
Use the -full image tag — the minimal image doesn’t include GPU monitoring dependencies.
Custom Configuration File
Create glances.conf for advanced settings:
[global]
refresh=5
check_update=false
[outputs]
curse_theme=black
[network]
hide=lo,docker.*
[diskio]
hide=loop.*
[containers]
show=true
[connections]
disable=true
Mount it in the container:
volumes:
- ./glances.conf:/etc/glances/glances.conf:ro
Export to Prometheus
Glances can expose metrics in Prometheus format:
environment:
- GLANCES_OPT=-w --export prometheus
ports:
- "61208:61208"
- "9091:9091" # Prometheus metrics endpoint
Add to your prometheus.yml:
scrape_configs:
- job_name: 'glances'
static_configs:
- targets: ['glances:9091']
REST API
Glances exposes a full REST API at http://your-server:61208/api/4/:
| Endpoint | Returns |
|---|---|
/api/4/cpu | CPU usage details |
/api/4/mem | Memory statistics |
/api/4/diskio | Disk I/O rates |
/api/4/network | Network interface stats |
/api/4/docker | Container resource usage |
/api/4/processlist | All running processes |
/api/4/all | Everything in one call |
Reverse Proxy
For Nginx Proxy Manager, create a proxy host pointing to http://glances:61208.
For Caddy:
glances.example.com {
reverse_proxy glances:61208
}
See Reverse Proxy Setup for detailed configuration.
Backup
Glances is stateless — it reads live system metrics and stores nothing persistently. Back up only your docker-compose.yml and glances.conf configuration files.
See Backup Strategy for a comprehensive approach.
Troubleshooting
Only Container Processes Visible
Symptom: Process list shows only Glances itself, not host processes.
Fix: Add pid: host to your Docker Compose configuration. This shares the host’s PID namespace with the container.
Network Interfaces Missing
Symptom: Only eth0 shows in network stats, not host interfaces like enp0s3.
Fix: Switch to network_mode: host. Bridge networking limits interface visibility.
Docker Containers Not Showing
Symptom: No container section in the dashboard.
Fix: Mount the Docker socket: /var/run/docker.sock:/var/run/docker.sock:ro. Ensure the container user has permissions to read the socket.
High CPU Usage
Symptom: Glances itself uses 10-20% CPU.
Fix: Increase the refresh interval in glances.conf: refresh=10 (default is 3 seconds). Disable unused plugins like connections.
Shows Alpine Linux Instead of Host OS
Symptom: System info shows “Alpine Linux” instead of your actual OS.
Fix: Mount /etc/os-release:/etc/os-release:ro in the container.
Frequently Asked Questions
Does Glances store historical data or is it real-time only?
Glances is primarily a real-time monitoring tool. By default, it shows live system metrics with no history. However, you can enable data export to InfluxDB, Prometheus, Elasticsearch, or CSV files for historical storage. For built-in historical monitoring with graphs, look at Netdata or Beszel. Glances is best used as a live dashboard, not a time-series platform.
Can Glances monitor multiple servers from one dashboard?
Yes, using Glances’ client-server mode. Run Glances in server mode on each remote machine (glances -s), then connect from a central Glances client or use the web UI’s server browser. Alternatively, export metrics from each server to a shared InfluxDB + Grafana instance for a unified multi-server dashboard.
What is the difference between the minimal and full Docker images?
The minimal image (nicolargo/glances:latest) is ~150 MB and includes core system monitoring (CPU, RAM, disk, network, processes). The full image (nicolargo/glances:latest-full) is ~400 MB and adds plugins for Docker monitoring, GPU stats (NVIDIA), RAID, sensors, and export modules (InfluxDB, Prometheus, MQTT). Use the minimal image unless you need specific plugins from the full version.
Why does Glances show Alpine Linux instead of my host OS?
By default, the container reads its own /etc/os-release (Alpine Linux) instead of the host’s. Mount the host’s OS release file: -v /etc/os-release:/etc/os-release:ro in your Docker Compose volumes. This gives Glances accurate host OS information in the system info section.
Can Glances send alerts when CPU or memory exceeds a threshold?
Not natively in the Docker web UI. Glances has a built-in alert system for terminal mode (colored warnings based on thresholds), but the web UI does not send external notifications. For alerting, export Glances data to Prometheus and use Alertmanager, or pair Glances with Uptime Kuma for threshold-based notifications. Glances is best for visual monitoring, not automated alerting.
Resource Requirements
| Resource | Usage |
|---|---|
| RAM | 50-100 MB |
| CPU | 1-3% (minimal image), 3-5% (full image) |
| Disk | ~150 MB (image), no persistent storage |
Glances is one of the lightest monitoring tools available. The minimal image is ~150 MB; the full image with all plugins is ~400 MB.
Verdict
Glances is the best single-container system monitor for quick deployment. It gives you everything htop, iotop, and docker stats provide, but in a web-accessible dashboard with an API. The trade-off is depth — it’s a real-time snapshot tool, not a time-series monitoring platform. There’s no historical data, no alerting, and no dashboarding beyond the built-in view.
Use Glances as your everyday “what’s happening on my server right now” tool. Pair it with Prometheus + Grafana for historical trends and alerting, or use Beszel if you want lightweight monitoring with history. For endpoint uptime checks, add Uptime Kuma.
Related
- Glances vs Beszel: Lightweight Monitoring Compared
- Glances vs Netdata: Self-Hosted Monitoring Compared
- Best Self-Hosted Monitoring Tools
- Grafana vs Netdata
- Netdata vs Glances
- How to Self-Host Beszel
- How to Self-Host Grafana
- How to Self-Host Prometheus
- Self-Hosted Alternatives to Datadog
- Docker Compose Basics
- Reverse Proxy Setup
Get self-hosting tips in your inbox
Get the Docker Compose configs, hardware picks, and setup shortcuts we don't put in articles. Weekly. No spam.
Comments