Support auto-delete of ACI when container exits normally
When an ACI container exits normally and the restart-policy is Never you should automatically delete the ACI. Currently it sticks around with a status of Terminated.
In my scenario I want to spin up ACI's to drain an Azure queue. When the queue is empty my ACI workers will exit and I do not want to have to go and clean up the ACI remnants afterwards. They should cleanly remove themselves as if they never existed.
This can be an option if there are scenarios where this is undesirable.
> What do you perceive as the benefits from auto-deletion of container groups? Ease of clean-up?
Yes, that'd be the primary benefit for me.
The idea is simular to using C++ destructors with local variables or the C# using statement for auto cleanup. Using auto clean-up lifts administrative maintenance burdon from the programmer.
We have the same issue, we want to 'fire-and-forget' some container instances, and we want to scale the amount of ACI depending on a service bus queue length.
However, setting up a timed job to clean up terminated containers is overkill.
Add that to the current limits per subscription, and a 'deletePolicy' would be nice.
John Patrick Boueri commented
@ACI Team, there are container limits that are enforced on the subscription level limiting the subscription to so many instances. Often times ACI is used as a one time job that's triggered to run. Clean up would prevent the subscription from hitting that limit and cleans up all the images. If log retention is important, as you suggest, LogAnalytics is an option
As commenters below mention, spinning up a function app to clean up is an additional component that ideally wouldn't have to be created
AdminACI Team (Admin, Microsoft Azure) commented
Leaving your container group in a terminated state gives you access to the logs and platform events (even if you haven't configured Log Analytics), while not accruing additional cost.
What do you perceive as the benefits from auto-deletion of container groups? Ease of clean-up?
Kunal Babre commented
I feel this is important scenerio, a property during deployment to explicitly ask delete on exit would be perfect. Also similar logic would benefit Failed ACIs.
Tobias Zimmergren commented
This is a scenario that keeps coming up more and more. I'm also looking for this capability, and currently have to deploy -another- set of resources (Functions, another ACI, Web Job,...) to check if the jobs/tasks the ACI are working on are done, and if so I delete the ACI. It still means I have a Function/WebJob/some-type-of-orchestrator logic in place to ensure the cleanup.
I've heard this several times echoed in the community as well, and it would indeed be helpful to have a new restart policy for this.