Hi all, is there any way to set and enforce expiry time for ephemeral instances ? Somewhat similar to how the Incus demo site has 30 minutes expiry, but within incus cli to set and refresh expiry times.
I have a scenario where I have to provide certain number of isolated or sandbox instances. The users will work on these instances with least privileges and they can’t shutdown instances. Not every instance starts or stops at the same time and neither do they have same expiry times. So, if there is a way to create instances with preset timer and get it auto delete after expiry of timer would be helpful. Sometimes, it could be that the timer needs to be refreshed or extended.
For example:
This sets the expiry timer to 10 minutes 10 seconds:
This looks like an interesting use-case. How do you start such containers so that they get autoremoved? Do you start them manually?
I would expect that the backend code of such a system would deal with the lifetime of containers. For example, look at the backend that implements the Incus demo server, GitHub - lxc/incus-demo-server: The Incus demo server In that configuration file there’s a key, timeout.
I would suggest to file a Feature request on Github for Incus, describing all these. Even in the case it does not get implemented straight away, there will be a record of the feature on Github.
A custom image with a simple cronjob in the instance that shuts down after preset minutes of up time. This is not ideal way, but get things done.
We have already tried the demo server, but for many instances its not suitable with the setup.
I came across this post with your reply and seems snapshot expiry approach could be replicated for this use case as well. There seems to be already a script available that can handle expiry string.