Glances
Stack
Glances is an open-source system cross-platform monitoring tool. It allows real-time monitoring of various aspects of your system such as CPU, memory, disk, network usage etc.
Image details
Source details
Configuration
TypeComposelinuxnicolargo/glances:latest-alpine/var/run/docker.sock : /var/run/docker.sockGLANCES_OPT=-walwaysStandalone Install
Select an install method, to see config/commands for deploying Glances
Install on Portainer
Import all app templates into your Portainer instance, for easy 1-click deploys
- Ensure both Docker and Portainer are installed, and up-to-date
- Log into your Portainer web UI
- Under Settings → App Templates, paste the below URL
- Head to Home → App Templates, and the list of apps will show up
- Select Glances, fill in any config options, and hit Deploy
Template Import URL
https://raw.githubusercontent.com/Lissy93/portainer-templates/main/templates.json
Show Me
Original stackfile
The compose file this template deploys, straight from its repo:
services:
glances-monitoring:
image: nicolargo/glances:latest-alpine
restart: always
pid: host
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- "GLANCES_OPT=-w"
Or deploy it directly from the source:
git clone https://github.com/xneo1/portainer_templates
cd portainer_templates
docker compose -f Template/Stack/glances.yml up -dMore install options in our documentation, or see nicolargo/glances for app-specific guidance.
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-devThen 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-devOr 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-devMultiple 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-fullThen 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-fullRun 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-fullAlternatively, 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-fullWhere \`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_OPTUsing GPU Plugin with Docker (Only Nvidia GPUs)
Complete the steps mentioned in thedocker docs <https://docs.docker.com/config/containers/resource_constraints/#gpu>
to make the GPU accessible by the docker engine.With
docker runInclude 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-fullWith docker-composeInclude 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]Check the logs first
Nine times out of ten the logs tell you exactly what went wrong.
- In Portainer, go to Containers, click the container, then Logs. Or run
docker logs <container> - Exit codes help too:
137means killed, usually out of memory.126or127means the command inside the image is broken.
Can't reach the Docker socket
glances-monitoring talks to Docker through /var/run/docker.sock. If the logs show
"permission denied while trying to connect to the Docker daemon socket", the app's user can't access it.
- Check the socket exists on the host:
ls -l /var/run/docker.sock - Run the container as root, or add the docker group's id to the container with
group_add.
Image won't pull
Test the pull directly on the host: docker pull nicolargo/glances:latest-alpine
- "manifest unknown" means the tag no longer exists.
- "toomanyrequests" is the Docker Hub rate limit. Log in with
docker loginto raise it. - "no space left on device" means a full disk. Reclaim space with
docker system prune
"exec format error"
This means the image was built for a different CPU architecture than your server.
- This image supports:
amd64, arm64 - Check yours with
uname -m: x86_64 is amd64, aarch64 is arm64. Raspberry Pi and other ARM boards are the usual culprits.
Container keeps restarting
The always restart policy relaunches the app after every crash, so the real error can scroll past.
- Check the logs right after a restart, the last few lines before it died are the useful ones.
- Get the exit code with
docker inspect <container> --format '{{.State.ExitCode}}' - Still stuck? Redeploy once with the restart policy set to
noso the failure stays visible.
Stack won't deploy
Compose stacks fail fast on small mistakes, and Portainer shows the reason just above the editor.
- YAML only accepts spaces for indentation, a single tab breaks the whole file.
Raise an issue
Found something which isn't working as it should? Here's how to report it.
- Bug within the app: Open an issue on nicolargo/glances
- Template not working: Open an issue on xneo1/portainer_templates
- This website not working: Open an issue on lissy93/portainer-templates
A Compose stack
Glances is a Compose stack, a set of containers defined in one file and brought up together by Portainer, then started and stopped as a single app.
The app image
An image is the app packed up ready to go, everything Glances needs bundled into one download. This template pulls nicolargo/glances:latest-alpine, which Docker fetches once (about 147 MB) and then starts your own copy from.
Where the image comes from
Docker pulls its images from registries, public libraries of ready-built apps. Glances's comes from Docker Hub, published by nicolargo.
Version tags
The bit after the colon in the image name is the version tag. This one pins latest-alpine, so every redeploy gives you that exact build until you bump it yourself.
Which machines it runs on
Every image is built for particular CPU types. This one ships for amd64, arm64, so it runs on both regular x86 servers and ARM boards like a Raspberry Pi.
Volumes
A volume is where Glances keeps its files so they survive an update or a restart. Without one, anything it saves would sit inside the container and vanish the moment it's recreated. This template mounts:
/var/run/docker.sockfrom/var/run/docker.sockon the host (a socket it talks to, not storage)
Environment variables
Environment variables are the settings you hand over when you deploy, things like a password or a timezone. Glances takes 1 of them, all with defaults you can leave alone or tweak:
GLANCES_OPT, defaults to-w
Restart policy
The restart policy here is always, so Docker brings Glances back up after a crash and again when the server reboots. Good for anything you want running around the clock. You can change this on the deploy screen. The choices are no (never restart), on-failure (only after a crash), unless-stopped (restart unless you stop it), and always (bring it back no matter what).
Networking
Nothing custom is set, so Glances sits on Docker's default bridge network: its own private space that reaches the outside world only through the ports it publishes.
Container name
Once it's deployed, Portainer names the container glances-monitoring. That's what you'll spot in the containers list and use in commands like docker logs glances-monitoring.
Platform
The platform is linux, the kind of system the container is built to run on. Docker and Portainer handle this on a normal Linux server.
Portainer app templates
Zooming out, this whole page comes from a Portainer app template: a short recipe telling Portainer how to set Glances up. Add the template list to Portainer once, then deploying Glances is a click rather than a wall of config.
Apprise-api (container) Monitoring
- Beszel Monitoring
CashPilot Monitoring
CheckCle Monitoring
Datadog agent (container) Monitoring
Datadog agent (swarm) Monitoring
Diskover (container) Monitoring
Gatus Monitoring
Glance Monitoring
Healthchecks Monitoring
HomeLab Monitor Monitoring
Librespeed Monitoring