PlanktoScope / forklift

Composable, reprovisionable, decentralized management of apps & configs on Raspberry Pis and other embedded Linux systems
Apache License 2.0
6 stars 0 forks source link

caching: `cache rm-img` shouldn't delete images which might be needed #228

Open ethanjli opened 1 month ago

ethanjli commented 1 month ago

Currently, if there are any container images which are not needed by the currently-active containers, the cache rm-img command will delete those images. This is because we're just using the Docker API client's ImagesPrune method. It would be more correct for us to keep any images which are needed by the current and next staged pallet bundles (and maybe also any images needed by the current pallet?), so that those container images are available during boot when we don't have internet access to download any missing container images.

Since image pruning is somewhat complex behind-the-scenes, here are some ideas for how we might implement this fix:

Also, the rmImgAction function should be moved from the cmd/forklift/cache/cache.go file to the cmd/forklift/cache/images.go file