Dynamic container launches

Hi there,

We’re working on a project that requires dynamic deployment (at runtime) of multiple containers. We have an edge-manager process that decides what containers need to be started/stopped based on cloud-side config. This config is real-time updated based on what the user does in our SaaS platform. This doesn’t lend itself well to multiple fleets, etc, as it would literally be a fleet-per-edge device. To be clear, the user isn’t (knowingly) managing containers; they’re configuring various aspects of our edge deployment; however, that will in turn result in the need to create many containers, which can come and go as the user makes further updates.

What we’d like to do it run our edge-manager as the primary application via Balena, but enable the edge-manager to then start/stop additional containers dynamically.

Is there a way to do this?

Hello - any help here by chance?! Thanks!

Hello, are you planning to have all the possible containers loaded on the device, but just stop and start them dynamically by your edge-manager container service? You might be able to use the on-device Supervisor API, specifically the start-service and stop-service endpoints: Interacting with the balena Supervisor - Balena Documentation - in this case you would have to keep in mind the restart policy for the container. (See Stopped containers keep restarting - #18 by 20k-ultra)
Approximately how many containers in total are you contemplating?

The Balena Gitlab runner might be interesting to you, since it is sawning containers dynamically.
It binds the DOCKER_HOST=unix:///var/run/balena-engine.sock and interacts with it.