Monitor all yours containers with this standalone Glances container (UI: console / Web + API)
100M+
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.
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
Get the Glances container:
docker pull nicolargo/glances:<version>
Available tags:
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.
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
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]
Content type
Image
Digest
sha256:9b4324c23…
Size
152.5 MB
Last updated
about 14 hours ago
docker pull nicolargo/glances:devPulls:
561,118
Last week