glances icon indicating copy to clipboard operation
glances copied to clipboard

docker glances container only shows root disk space

Open crusaderky opened this issue 5 years ago • 3 comments

I'm using glances docker image, as documented in README.md:

docker pull nicolargo/glances
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 docker.io/nicolargo/glances

This is what I read in the FILE SYS panel:

FILE SYS	Used	Total
_olv.conf (/dev/sda2)	3.53G	31.2G
_hostname (/dev/sda2)	3.53G	31.2G
_tc/hosts (/dev/sda2)	3.53G	31.2G

The 31.2G disk is my root mountpoint on the host running docker. I have other mountpoints on /dev/md0 that are missing. I can see md0 in the DISK IO panel.

crusaderky avatar Mar 12 '19 08:03 crusaderky

Hi, I've been struggling for the same reason and just found out that mounting the whole host fs in a read-only directory of the guest provides a reasonable workaround. In this way the docker mount information includes the host information as well.

This is how I start the docker container:

docker run  -d --restart="always" -p 61208-61209:61208-61209 -e GLANCES_OPT="-w -t 10" -v /var/run/docker.sock:/var/run/docker.sock:ro -v /:/rootfs:ro --cpus=0.25 --name glances --pid host docker.io/nicolargo/glances

So that I get both the host and guest partitions information:

FILE SYS	Used	Total
/rootfs (/dev/nvme0n1p1)	16.4G	98.3G
_otfs/srv (/dev/nvme1n1)	451G	984G
_overlay2 (/dev/nvme1n1)	451G	984G
_/althome (/dev/nvme2n1p1)	23.1G	98.3G
_olv.conf (/dev/nvme1n1)	451G	984G
_hostname (/dev/nvme1n1)	451G	984G
_tc/hosts (/dev/nvme1n1)	451G	984G

desmoteo avatar Nov 21 '19 09:11 desmoteo

Same issue, I'd love to just list my various /dev/sd* and nothing else.

dphildebrandt avatar Aug 05 '20 04:08 dphildebrandt

So for anyone else that gets here, i added in readonly mounts of the drives i was interested in. how i configured it with docker was, in my docker-compose for glances:

  monitoring_glances:
    image: nicolargo/glances:latest-full
    pid: host
    network_mode: host
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./glances/glances.conf:/etc/glances.conf
      - /mnt/fourteena/Movies:/fourteena:ro
      - /mnt/toshix/Movies:/toshix:ro
      - /mnt/tendra/Movies:/tendra:ro
      - /mnt/stuff:/stuff:ro

then in my glances.conf file under fs i have

[fs]
disable=False
# Define the list of file system to hide (comma-separated regexp)
#hide=/boot.*,/snap.*,/usr.*
hide=loop.*,/dev/loop.*,/etc.*

which gives me the following image

tphoney avatar Nov 18 '23 12:11 tphoney