I am running Balena devices in some customer sites that I can’t readily access. I have deleted some of these devices from my Balena application but then realised that the device and container on it are still running. This means they are still sending data to my backend system. I am wondering if there is a command I can run on a Balena device to delete all containers and images before I delete the device from the Balena dashboard.
I have seen the Purge data action, but this seems to just delete all data on the writable partition. I could also imagine publishing a dummy release, which just has a container that spins in a sleep loop forever. But is there a specific action to delete all containers and images on a device before removing it from a Balena application?
thanks for the interesting question. Right now there is no direct functionality for your use case. As you’ve already stated, you could create a dummy release with a service that runs only once . The better approach is to create a dummy application without any release and move the device into the dummy application (this omits any sleep / idle service definition). This will keep your device accessible for future use and will stop and delete all existing services from the device.
For better understanding, do you need the device to be de-provisioned at all, or just to be idle and ready to be re-provisioned to an application again? I would like to understand your use case better.
For a bit of background, we run these devices on some of our customer sites. If a customer no longer wants to use our service, we want to stop and delete the device remotely. Sometimes these devices get left powered on and continue to run. So it would be good to have a way to stop all containers, delete docker images and data from the device.
In this situation, we want the de-provision the device and delete it from our application. We don’t need to re-provision it later on.
thanks for the added context of your use case. I’ve recorded your use case and the needed functionality internally. If you need any support let us know.
Would publishing a dummy release (such as a container with an infinite sleep loop) be an effective solution for clearing out running containers and images on a Balena device before removal?