Ix-apps/docker dataset grows uncontrollably (probably Immich)

I use a 128GB non-redundant SSD volume (called SSD_pool) as a pool for TrueNAS apps. The pool usage is continuously growing and is now at over 100GB in less than a year. I use only a few apps: Immich, Frigate, Nextcloud, and a Thunderbird client, and I suspect the culprit is Immich. All “media” files (Immich uploads, Frigate recordings, Nextcloud shares etc.) are of course stored on a large HDD raid, the SSD pool is only for the app files and cache. Immich uses 2 extra datasets on the SSD pool for the database and machine learning cache (in addition to the actual photos storage off the SSD), but these 2 datasets are only a few GB. The ix-apps datasets for the other apps are also in the single-digit GB range combined. However the docker folder within ix-apps is 92GB in size. Here’s a list of the SSD pool datasets according to “zfs list -o space”:

ssd_pool                                                   18.7G   105G        0B     96K             0B       105G
ssd_pool/.ix-virt                                          18.7G  1.12M        0B     96K             0B      1.03M
ssd_pool/.ix-virt/buckets                                  18.7G    96K        0B     96K             0B         0B
ssd_pool/.ix-virt/containers                               18.7G    96K        0B     96K             0B         0B
ssd_pool/.ix-virt/custom                                   18.7G    96K        0B     96K             0B         0B
ssd_pool/.ix-virt/deleted                                  18.7G   576K        0B     96K             0B       480K
ssd_pool/.ix-virt/deleted/buckets                          18.7G    96K        0B     96K             0B         0B
ssd_pool/.ix-virt/deleted/containers                       18.7G    96K        0B     96K             0B         0B
ssd_pool/.ix-virt/deleted/custom                           18.7G    96K        0B     96K             0B         0B
ssd_pool/.ix-virt/deleted/images                           18.7G    96K        0B     96K             0B         0B
ssd_pool/.ix-virt/deleted/virtual-machines                 18.7G    96K        0B     96K             0B         0B
ssd_pool/.ix-virt/images                                   18.7G    96K        0B     96K             0B         0B
ssd_pool/.ix-virt/virtual-machines                         18.7G    96K        0B     96K             0B         0B
ssd_pool/.system                                           18.7G  2.24G        0B   1.87G             0B       380M
ssd_pool/.system/configs-ae32c386e13840b2bf9c0083275e7941  18.7G  23.1M        0B   23.1M             0B         0B
ssd_pool/.system/cores                                     1024M   120K        0B    120K             0B         0B
ssd_pool/.system/netdata-ae32c386e13840b2bf9c0083275e7941  18.7G   357M        0B    357M             0B         0B
ssd_pool/.system/nfs                                       18.7G   112K        0B    112K             0B         0B
ssd_pool/.system/samba4                                    18.7G   376K        0B    376K             0B         0B
ssd_pool/.system/vm                                        18.7G    96K        0B     96K             0B         0B
ssd_pool/ix-apps                                           18.7G  95.5G        0B    428K             0B      95.5G
ssd_pool/ix-apps/app_configs                               18.7G  70.9M        0B   70.9M             0B         0B
ssd_pool/ix-apps/app_mounts                                18.7G  2.97G        0B    104K             0B      2.97G
ssd_pool/ix-apps/app_mounts/frigate                        18.7G   119M        0B    104K             0B       119M
ssd_pool/ix-apps/app_mounts/frigate/cache                  18.7G   114M     57.4M   56.3M             0B         0B
ssd_pool/ix-apps/app_mounts/frigate/config                 18.7G  4.85M      836K   4.04M             0B         0B
ssd_pool/ix-apps/app_mounts/nextcloud                      18.7G  2.85G        0B    104K             0B      2.85G
ssd_pool/ix-apps/app_mounts/nextcloud/data                 18.7G  1.26G     3.12M   1.26G             0B         0B
ssd_pool/ix-apps/app_mounts/nextcloud/html                 18.7G  1019M      491M    528M             0B         0B
ssd_pool/ix-apps/app_mounts/nextcloud/postgres_data        18.7G   606M     33.9M    572M             0B         0B
ssd_pool/ix-apps/app_mounts/thunderbird                    18.7G   192K        0B     96K             0B        96K
ssd_pool/ix-apps/app_mounts/thunderbird/storage_entry      18.7G    96K        0B     96K             0B         0B
--> ssd_pool/ix-apps/docker                                    18.7G  92.0G        0B   92.0G             0B         0B
ssd_pool/ix-apps/truenas_catalog                           18.7G   444M        0B    444M             0B         0B
ssd_pool/mlCache                                           18.7G  4.72G        0B   4.72G             0B         0B
ssd_pool/pgData                                            18.7G  1.63G        0B   1.63G             0B         0B
ssd_pool/thunderbird                                       18.7G   707M        0B    707M             0B         0B

I assume the docker dataset must be used by Immich because the other apps have their own ix-apps datasets. At this point I’m stuck with the diagnosis of what’s causing the docker dataset to bloat so much. Browsing this docker folder directly (with ls and sudo) doesn’t really help much without knowing what to look for. What would be the next step to figure out what’s hogging the space?

Have you run a docker prune -a -f to see what that clears out?

Thanks, that did it! It should be “docker system prune -a -f” though (and requires an elevated prompt).

I also looked a bit more into it and discovered that it’s not “just” Immich but simply all app container images which for some reason never get cleaned up after an update.

It’s no big deal to run the prune command every few months or so, but is there a way to automatically clean unused/outdated app images after an update?

Docker upstream leaves that to the local admin’s discretion. You’re stuck with creating your own cron job.

You can also add docker system prune -a -f --volumes to clean out anonymous volumes too.