nicolargo/glances

By nicolargo

Updated 7 days ago

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

Image
Monitoring & Observability
Networking

50M+

Glances - An eye on your system

Glances containers are availables. You can use it to monitor your server and all your other containers !

Quick start

Pull the full developement version:

docker pull nicolargo/glances:alpine-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:latest

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:latest

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
  • latest for a basic Alpine Glances (latest release) version with minimal dependencies (Bottle and Docker)
  • dev for a basic Alpine Glances image (based on development branch) with all dependencies (Warning: may be instable)
  • 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 (Bottle and Docker)
  • ubuntu-dev for a basic Ubuntu Glances image (based on development branch) with all dependencies (Warning: may be instable)

You can also specify a version (example: 3..4.0).

Pull the latest full version:

docker pull nicolargo/glances: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: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: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: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:latest
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: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: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]

Docker Pull Command

docker pull nicolargo/glances