nicolargo/glances

Sponsored OSS

By Le blog de Nicolargo

Updated about 14 hours ago

Monitor all yours containers with this standalone Glances container (UI: console / Web + API)

Image
Networking
Monitoring & observability
215

100M+

nicolargo/glances repository overview

Glances - An eye on your system

Glances is an open-source software designed to monitor your host (where the container is ran) and all others containers.

Users can use a console or web based user interface and export stats to CSV/JSON files or time-series databases.

Quick start

Pull the full development version (ubuntu-dev or alpine-dev tags):

docker pull nicolargo/glances:ubuntu-dev

Then run the container in console mode:

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro --pid host --network host -it nicolargo/glances:ubuntu-dev

Or run the container in web ui mode:

docker run -d --restart="always" -p 61208-61209:61208-61209 -e GLANCES_OPT="-w" -v /var/run/docker.sock:/var/run/docker.sock:ro -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro --pid host nicolargo/glances:ubuntu-dev

Multiple versions are available

Get the Glances container:

docker pull nicolargo/glances:<version>

Available tags:

  • latest-full for a full Alpine Glances image (latest release) with all dependencies
  • ubuntu-latest-full for a full Ubuntu Glances image (latest release) with all dependencies
  • ubuntu-latest for a basic Ubuntu Glances (latest release) version with minimal dependencies (FastAPI and Docker)
  • latest for a basic Alpine Glances (latest release) version with minimal dependencies (FastAPI and Docker)
  • dev for a basic Alpine Glances image (based on development branch and latest cyber security updates) with all dependencies (Warning: may be instable)
  • ubuntu-dev for a basic Ubuntu Glances image (based on development branch and latest cyber security updates) with all dependencies (Warning: may be instable)

You can also specify a version (example: 4.3.1).

Pull the latest full version:

docker pull nicolargo/glances:ubuntu-latest-full

Then run the container in console mode:

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it nicolargo/glances:ubuntu-latest-full

Run the container in Web server mode (notice the GLANCES_OPT environment variable setting parameters for the glances startup command):

docker run -d --restart="always" -p 61208-61209:61208-61209 -e GLANCES_OPT="-w" -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host nicolargo/glances:ubuntu-latest-full

Alternatively, you can specify something along the same lines with docker run options:

docker run -v `pwd`/glances.conf:/glances/conf/glances.conf -v /var/run/docker.sock:/var/run/docker.sock:ro -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro --pid host -it nicolargo/glances:ubuntu-latest-full

Where `pwd`/glances.conf is a local directory containing your glances.conf file.

Build your own container

Additionally, if you want to use your own glances.conf file, you can create your own Dockerfile:

FROM nicolargo/glances:ubuntu-latest-full
COPY glances.conf /glances/conf/glances.conf
CMD python -m glances -C /glances/conf/glances.conf $GLANCES_OPT

Using GPU Plugin with Docker (Only Nvidia GPUs)

Complete the steps mentioned in the docker docs <https://docs.docker.com/config/containers/resource_constraints/#gpu>_ to make the GPU accessible by the docker engine.

With docker run

Include the --gpus flag with the docker run command.

Note: Make sure the --gpus is present before the image name in the command, otherwise it won't work.

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro -v /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock:ro --gpus --pid host --network host -it docker.io/nicolargo/glances:ubuntu-latest-full

With docker-compose

Include the deploy section in compose file as specified below in the example service definition.

version: '3'

services:
  monitoring:
    image: nicolargo/glances:ubuntu-latest-full
    pid: host
    network_mode: host
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /run/user/1000/podman/podman.sock:/run/user/1000/podman/podman.sock
    environment:
      - "GLANCES_OPT=-w"
    # For nvidia GPUs
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities: [gpu]

Tag summary

Content type

Image

Digest

sha256:9b4324c23

Size

152.5 MB

Last updated

about 14 hours ago

docker pull nicolargo/glances:dev

This week's pulls

Pulls:

561,118

Last week