Glances can be installed through Docker, allowing you to run it without installing all the python dependencies directly on your system. Once you have [docker installed](, you can

Get the Glances container:

docker pull nicolargo/glances:<version>

Available tags (all images are based on both Alpine and Ubuntu Operating System):

  • 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). All available versions can be found on DockerHub.

An Example to pull the latest tag:

docker pull nicolargo/glances:latest

Run the container in console mode:

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro --pid host --network host -it

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

FROM nicolargo/glances
COPY glances.conf /glances/conf/glances.conf
CMD python -m glances -C /glances/conf/glances.conf $GLANCES_OPT

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 --pid host -it

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

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

Note: if you want to see the network interface stats within the container, add –net=host –privileged

You can also include Glances container in you own docker-compose.yml. Here’s a realistic example including a “traefik” reverse proxy serving an “whoami” app container plus a Glances container, providing a simple and efficient monitoring webui.

version: '3'

    image: traefik:alpine
    command: --api --docker
      - "80:80"
      - "8080:8080"
      - /var/run/docker.sock:/var/run/docker.sock

    image: emilevauge/whoami
      - "traefik.frontend.rule=Host:whoami.docker.localhost"

    image: nicolargo/glances:latest-alpine
    restart: always
    pid: host
      - /var/run/docker.sock:/var/run/docker.sock
      - "GLANCES_OPT=-w"
      - "traefik.port=61208"
      - "traefik.frontend.rule=Host:glances.docker.localhost"

How to protect your Dockerized server (or Web server) with a login/password ?

Below are two methods for setting up a login/password to protect Glances running inside a Docker container.

Option 1

You can enter the running container by entering this command (replacing glances_docker with the name of your container):

docker exec -it glances_docker sh

and generate the password file (the default login is glances, add the --username flag if you would like to change it):

glances -s --password

which will prompt you to answer the following questions:

Define the Glances server password (glances username):
Password (confirm):
Do you want to save the password? [Yes/No]: Yes

after which you will need to kill the process by entering CTRL+C (potentially twice), before leaving the container:


You will then need to copy the password file to your host machine:

docker cp glances_docker:/root/.config/glances/glances.pwd ./secrets/glances_password

and make it visible to your container by adding it to docker-compose.yml as a secret:

version: '3'

    image: nicolargo/glances:latest
    restart: always
      - GLANCES_OPT="-w --password"
      - /var/run/docker.sock:/var/run/docker.sock:ro
    pid: host
      - source: glances_password
        target: /root/.config/glances/glances.pwd

    file: ./secrets/glances_password

Option 2

You can add a [passwords] block to the Glances configuration file as mentioned elsewhere in the documentation:

# Define the passwords list
# Syntax: host=password
# Where: host is the hostname
#        password is the clear password
# Additionally (and optionally) a default password could be defined

Using GPU Plugin with Docker (Only Nvidia GPUs)

Complete the steps mentioned in the docker docs 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 --gpus --pid host --network host -it

With docker-compose

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

version: '3'

    image: nicolargo/glances:latest-full
    pid: host
    network_mode: host
      - /var/run/docker.sock:/var/run/docker.sock
      - "GLANCES_OPT=-w"
    # For nvidia GPUs
            - driver: nvidia
              count: 1
              capabilities: [gpu]