Mass delete cached images or disable local image store all together

Is this possible? I don’t need the cached images after an ephemeral OCI instance is running. The goal is to always download the latest version of an OCI image when launching the instance.

Secondary goal is to save diskspace. I can delete the images from /var/lib/incus/images but then incus refuses to download the remote image when launching since the local image is missing.

I have to manually delete the images I need from incus database one by one and that is tedious. Is there any way to automate this? Is there any way to remove all missing images from the database?

You can’t turn the feature off completely but you can make the images go away faster by setting images.remote_cache_expiry, though as previously mentioned, Incus will always fetch the latest image (so long as it has internet connectivity) and the cached image auto-updates itself every 6 hours (configurable) so the local cache isn’t just made of old images, it’s made of the latest version of the images you’ve used over the past 10 days.

Does it work the same way with OCI images? So if the container is launched with docker:XXX:latest, it should always be the latest version?

About the other question, if /var/lib/incus/images has been deleted and there are no running containers, is there a way to clean the database of these missing images other than manually going one by one?

Incus will clean up the database on daemon restart if some images have disappeared from /var/lib/incus/images/.

For image updates, yeah, it should still work the same.
When an instance is created by Incus, the cached image has its source recorded (visible with incus image info), then that source is queried every 6 hours (configurable) and if it points to a different image than that cached, Incus will download the new image and replace the cached one with the new one.

Thank you, this gives me ideas how to setup my system.

Incus will clean up the database on daemon restart if some images have disappeared from /var/lib/incus/images/.

I tried it, but unfortunaletely this is not the case. I built from source, not sure if it matters, but the images are not cleaned up, I tried with systemctl restart and full reboot, no difference. Images are still shown with “image list” and launch fails because they are missing from disk.