Skip to main content

Introduction

Glances is an open-source, cross-platform system monitoring tool for Docker containers that provides a real-time dashboard of your system and its running containers. The Docker version is a self-hosted application that allows you to easily monitor your host machine and all of its containers through a web interface or terminal.

Key features of Glances for Docker
  • Comprehensive monitoring: Glances tracks a wide range of metrics, including CPU, memory, disk I/O, network activity, load average, and process lists.
  • Container-specific insights: In addition to host-level metrics, Glances directly monitors Docker containers, allowing you to view statistics for individual containers.
  • Flexible interfaces: You can access the Glances dashboard through a console-based interface in your terminal or a web-based interface that works in any browser.
  • Client-server and standalone modes: Glances can run in standalone mode to monitor a single machine or in client-server mode for remote monitoring of multiple systems.
  • Data export: Statistics can be exported to various formats and databases, including CSV, JSON, InfluxDB, and Elasticsearch, for long-term storage and analysis.
  • Lightweight and customizable: Written in Python, Glances uses minimal system resources and can be customized with plugins and configuration options.
How it works with Docker
The official Glances Docker image, available on Docker Hub as nicolargo/glances, provides a pre-packaged way to run the application.
To function correctly within a container, the Glances application typically needs access to the host machine's resources and the Docker daemon's socket. This is achieved by running the container with specific flags: 
  • --pid host: Allows Glances to see all processes running on the host system, not just those within the container.
  • -v /var/run/docker.sock:/var/run/docker.sock:ro: Mounts the Docker socket as read-only, giving Glances access to the Docker API to monitor containers.
  • --network host: Allows Glances to monitor the host machine's network interfaces directly.