An update: as I’ve taken a backup and run an update, I also ran a cleanup.
I’m fairly sure that the tools to manage docker images are preferable to direct action on /var/lib/docker/overlay2. And the automatic cleanup is preferable to those tools. (But as noted in the linked posts, there are other ways in which disk space gets used: backups, swapfiles, journal files, uploads, imports, log files, and so on)
Here’s what I saw, as an ‘after’ to the ‘before’ posted above - note that the starting point is lower on free disk space, probably because of the backup:
# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 25G 19G 5.1G 79% /
# docker images -a
REPOSITORY TAG IMAGE ID CREATED SIZE
local_discourse/app latest 8da0107aba03 2 months ago 2.7GB
discourse/base 2.0.20210415-1332 30e4746e631e 3 months ago 2.23GB
<none> <none> 1e6bf44c2762 5 months ago 2.46GB
discourse/base 2.0.20201221-2020 c0704d4ce2b4 7 months ago 2.11GB
# /var/discourse/launcher cleanup
WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y
Total reclaimed space: 0B
WARNING! This will remove all images without at least one container associated to them.
Are you sure you want to continue? [y/N] y
Deleted Images:
untagged: discourse/base:2.0.20201221-2020
untagged: discourse/base@sha256:e18*
deleted: sha256:1e6*
deleted: sha256:a22*
deleted: sha256:c07*
deleted: sha256:9b7*
deleted: sha256:87c*
untagged: discourse/base:2.0.20210415-1332
untagged: discourse/base@sha256:b3b*
Total reclaimed space: 2.456GB
# docker images -a
REPOSITORY TAG IMAGE ID CREATED SIZE
local_discourse/app latest 8da0107aba03 2 months ago 2.7GB
<none> <none> 30e4746e631e 3 months ago 2.23GB
# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
local_discourse/app latest 8da0107aba03 2 months ago 2.7GB
# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 25G 17G 7.8G 68% /
# docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 1 1 2.699GB 0B (0%)
Containers 1 1 1.13GB 0B (0%)
Local Volumes 0 0 0B 0B
Build Cache 0 0 0B 0B
# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 25G 17G 7.8G 68% /
# du -shc /var/lib/docker/overlay2/*
4.9G /var/lib/docker/overlay2/627*
40K /var/lib/docker/overlay2/627*-init
2.3G /var/lib/docker/overlay2/91d*
592M /var/lib/docker/overlay2/d81*
76M /var/lib/docker/overlay2/fb9*
24K /var/lib/docker/overlay2/l
7.8G total
# du -shc /var/lib/docker/overlay2/*/diff
20K /var/lib/docker/overlay2/627*-init/diff
1.2G /var/lib/docker/overlay2/627*/diff
2.3G /var/lib/docker/overlay2/91d*/diff
592M /var/lib/docker/overlay2/d81*/diff
76M /var/lib/docker/overlay2/fb9*/diff
4.2G total