Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --replace to incus image import #1383

Open
stefanor opened this issue Nov 16, 2024 · 7 comments
Open

Add --replace to incus image import #1383

stefanor opened this issue Nov 16, 2024 · 7 comments
Labels
Easy Good for new contributors Feature New feature, not a bug
Milestone

Comments

@stefanor
Copy link
Contributor

Incus expires remote images after a while, but there is no equivalent mechanism for local images.

I build my own images locally, occasionally. The latest image for each release gets an alias, taking it away from the previous image. It would be nice if there was a way to expire out the old images automatically. At the moment I have to do that manually.

@stgraber
Copy link
Member

That one is a bit tricky :)

We do have the concept of an image expiry that you can set through incus publish --expire DATE but that's something you set at image creation time and more meant to indicate an end of support than when the image should be auto-deleted.

In general I don't want us to try to be too smart about deleting images that didn't come from an external source as that could lead to straight up data loss.

How are your images generated? Are you using incus publish? If so, we could add a --delete flag which when combined with --reuse would delete the previous image for you.

@stefanor
Copy link
Contributor Author

My image building script is here: https://salsa.debian.org/-/snippets/750 So, image import, not publish.

I think what I'm looking for is something like an ephemeral flag on images. Where if it has no aliases, it's allowed to just expire away.

@stgraber
Copy link
Member

Do you have a reason to want the previous image to still exist following that image import call?

If not, we could pretty easily put a --replace flag in there to have it get rid of the previous image when the alias(es) passed already point to an existing image.

@stefanor
Copy link
Contributor Author

Do you have a reason to want the previous image to still exist following that image import call?

If the new one were no good for some reason, possibly. But that's not a problem I've had to deal with, so --replace sounds perfectly good to me.

@stgraber
Copy link
Member

Sounds good, we can definitely add something like that!

@stgraber stgraber changed the title Local image expiry Add --replace to incus image import Nov 19, 2024
@stgraber stgraber added Feature New feature, not a bug Easy Good for new contributors labels Nov 19, 2024
@stgraber stgraber added this to the incus-6.8 milestone Nov 19, 2024
@helmutg
Copy link

helmutg commented Nov 19, 2024

I'm not sure about the underlying mechanics here, but it feels conceivable that - at the time of updating the image - there still is a container using the old one. Once it is finished doing its thing, I no longer need the old image, but until the old container exits, I'd prefer the replaced image to continue to be available.

Is this covered?

@stgraber
Copy link
Member

Unlike say Docker where you need the image to be around for the container to be functional, this isn't the case with Incus. Images are only used at the time the instance is created and it can be deleted from the image store immediately afterwards.

So there generally isn't really a reason to want to keep an image around just because you have a container on the system which was created from it. As our instances can be very long lived (multiple years), doing so would quickly lead to a rather sizable pile of images being kept around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Easy Good for new contributors Feature New feature, not a bug
Development

No branches or pull requests

3 participants