Docker prune – no disk space reclaimed

Spread the love


Advertisement

I'm not totally sure whether this is an Apple question or a Docker question, but I think it's mostly about Apple's file system reporting.

Advertisements

I've been using Docker various times over the past months/years, and meanwhile I've been noticing my local disk usage grow fuller & fuller. Here's a df of my laptop's drive:

% df -h
Filesystem                               Size   Used  Avail Capacity  iused     ifree %iused  Mounted on
/dev/disk1s5s1                          466Gi   22Gi   16Gi    57%   501138 172842000    0%   /
devfs                                   191Ki  191Ki    0Bi   100%      660         0  100%   /dev
/dev/disk1s4                            466Gi  4.0Gi   16Gi    20%        4 172842000    0%   /System/Volumes/VM
/dev/disk1s2                            466Gi  379Mi   16Gi     3%     2225 172842000    0%   /System/Volumes/Preboot
/dev/disk1s6                            466Gi  104Mi   16Gi     1%      466 172842000    0%   /System/Volumes/Update
/dev/disk1s1                            466Gi  422Gi   16Gi    97%  3162234 172842000    2%   /System/Volumes/Data
map auto_home                             0Bi    0Bi    0Bi   100%        0         0  100%   /System/Volumes/Data/home
//[email protected]:64318/Google%20Drive  100Gi   88Gi   12Gi    88% 22991589   3222809   88%   /Volumes/GoogleDrive
/dev/disk1s5                            466Gi   22Gi   16Gi    57%   502050 172842000    0%   /System/Volumes/Update/mnt1

So there's 16GB free. About 97% used.

Docker also reports a gazillion local volumes, so I do docker volume prune:

% docker volume prune
WARNING! This will remove all local volumes not used by at least one container.
Are you sure you want to continue? [y/N] y
Deleted Volumes:
9e00293745ae3fc4feea108396fcdd8256bfc046fa283d87c6737196dcf2779a
5ca5d7dc808a2cd561cd04d72f7b924fc9075f511cd82de859c50911a7cc4d59
...
d3c923cb6abf4a5967da6609d6e7ed863772db6b90063c41d2024e42cabdfa58
ee75c0801592c390d4197bd71274307fc230e8e420773481cb39aa9727b32953

Total reclaimed space: 35.27GB

Awesome, 35GB pruned. Except:

% df -h
Filesystem                               Size   Used  Avail Capacity  iused     ifree %iused  Mounted on
/dev/disk1s5s1                          466Gi   22Gi   16Gi    58%   501138 172331040    0%   /
devfs                                   191Ki  191Ki    0Bi   100%      660         0  100%   /dev
/dev/disk1s4                            466Gi  4.0Gi   16Gi    20%        4 172331040    0%   /System/Volumes/VM
/dev/disk1s2                            466Gi  379Mi   16Gi     3%     2225 172331040    0%   /System/Volumes/Preboot
/dev/disk1s6                            466Gi  104Mi   16Gi     1%      466 172331040    0%   /System/Volumes/Update
/dev/disk1s1                            466Gi  422Gi   16Gi    97%  3162288 172331040    2%   /System/Volumes/Data
map auto_home                             0Bi    0Bi    0Bi   100%        0         0  100%   /System/Volumes/Data/home
//[email protected]:64318/Google%20Drive  100Gi   88Gi   12Gi    88% 22991589   3222809   88%   /Volumes/GoogleDrive
/dev/disk1s5                            466Gi   22Gi   16Gi    58%   502050 172331040    0%   /System/Volumes/Update/mnt1

Nothing much has changed, still 97% full.

Is there some Funny Business going on here that I don't understand? Has Docker not really deleted its files, or is df not reporting correctly, or something else?

As another data point, I also used CleanMyMac to find a directory containing a Steam game (Superliminal) that was 11GB, I uninstalled that game, observed that the directory /Users/ken/Library/Application Support/Steam/steamapps/common/ is now empty, but still df reports no improvement in free disk space.

My drive formats are:

% mount
/dev/disk1s5s1 on / (apfs, sealed, local, read-only, journaled)
devfs on /dev (devfs, local, nobrowse)
/dev/disk1s4 on /System/Volumes/VM (apfs, local, noexec, journaled, noatime, nobrowse)
/dev/disk1s2 on /System/Volumes/Preboot (apfs, local, journaled, nobrowse)
/dev/disk1s6 on /System/Volumes/Update (apfs, local, journaled, nobrowse)
/dev/disk1s1 on /System/Volumes/Data (apfs, local, journaled, nobrowse)
map auto_home on /System/Volumes/Data/home (autofs, automounted, nobrowse)
//[email protected]:64318/Google%20Drive on /Volumes/GoogleDrive (smbfs, nodev, nosuid, nobrowse, mounted by ken)
/dev/disk1s5 on /System/Volumes/Update/mnt1 (apfs, sealed, local, journaled, nobrowse)

And my OS version is:

% sw_vers
ProductName:    macOS
ProductVersion: 12.4
BuildVersion:   21F79

Author: Subham

Leave a Reply

Your email address will not be published. Required fields are marked *