glances
glances copied to clipboard
Docker plugin does not work in Glances Docker image tag latest-alpine
Describe the bug
The Docker plugin does not work when running glances via Docker (specifically via docker compose) using the tag latest-alpine
(the one recommended in documentation). The exact same configuration, but with the latest
tag (Ubuntu) does work as expected.
To Reproduce Steps to reproduce the behavior:
- Make a new directory for testing, such as
/tmp/dockertest
- Prepare the following docker-compose definition in
/tmp/dockertest/docker-compose.yml
:
version: "3.8"
services:
glances:
container_name: glances_test
image: nicolargo/glances:latest-alpine
restart: always
pid: host
ports:
- "61208:61208"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- GLANCES_OPT=-w --enable-plugin docker
- From the
/tmp/dockertest
directory bring up the container by runningdocker-compose up -d
- Access the Glances web UI at
http://<host>:61208
- Note that Docker container names are not reported.
To verify this works with the latest
tag (Ubuntu), re-run the above steps again but with the image line set to nicolargo/glances:latest
. Container names will be reported, as expected.
Expected behavior The Docker plugin should function, and report container names in the UI.
Desktop (please complete the following information):
- OS:
GNU/Linux Ubuntu 20.04, with Docker 19.03.8, docker-compose 1.26.2
- Glances Version:
v3.1.6_b1 with PsUtil v5.7.0
(latest-alpine image ID55277551f065
) - Glances logs file [output of
docker-compose exec glances tail -n10 /tmp/glances-root.log
]:
2021-01-11 00:33:32,069 -- WARNING -- Sparklines module not found (No module named 'sparklines')
2021-01-11 00:33:32,070 -- WARNING -- Missing Python Lib (No module named 'cpuinfo'), Quicklook plugin will not display CPU info
2021-01-11 00:33:32,073 -- WARNING -- Missing Python Lib (No module named 'pymdstat'), Raid plugin is disabled
2021-01-11 00:33:32,085 -- WARNING -- Missing Python Lib (No module named 'pySMART'), HDD Smart plugin is disabled
2021-01-11 00:33:32,092 -- WARNING -- Missing Python Lib (No module named 'wifi'), Wifi plugin is disabled
2021-01-11 00:33:32,092 -- WARNING -- Wifi lib is not compliant with Python 3, Wifi plugin is disabled
2021-01-11 00:33:32,519 -- INFO -- Glances RESTful API Server started on http://0.0.0.0:61208/api/3/
2021-01-11 00:33:32,524 -- INFO -- Glances Web User Interface started on http://0.0.0.0:61208/
2021-01-11 00:40:01,733 -- INFO -- Start Glances 3.1.6_b1
2021-01-11 00:40:01,733 -- INFO -- CPython 3.8.5 and psutil 5.7.0 detected
Additional context Possibly related to #728 / #740 / #1752
I just add the docker-py dep to the DockerFile (see https://github.com/nicolargo/glances/commit/74a499b5782cfc0a38dd6d3367e02971c273c74a).
But a better solution will be to create a virtualenv inside the Alpine container and deploy all the requirements (from the requirements.txt file) with pip.
Any contributors are welcome.
Currently the latest-alpine
tag is a near bare alpine image which has limitied support for the available plugins for glances.
It will be probably be fixed in #1786 if we provide a new image with more deps inside the alpine build.
Otherwise we will see such problems with different plugins every now and then.
Currently the
latest-alpine
tag is a near bare alpine image which has limitied support for the available plugins for glances. It will be probably be fixed in #1786 if we provide a new image with more deps inside the alpine build.Otherwise we will see such problems with different plugins every now and then.
Thanks. Would it be appropriate to perhaps recommend the latest
tags instead of latest-alpine
in the documentation then, and indicate this caveat for the alpine images? Especially for the Docker instructions, I imagine many people using that are interested in monitoring Docker itself (https://glances.readthedocs.io/en/latest/docker.html)
dokcer library is available in base image now.
Closing as issue is already resolved.