# Dynamic container launches

**URL:** <https://forums.balena.io/t/dynamic-container-launches/367564>\
**Category:** Product support\
**Created:** [April 7, 2023, 2:33am UTC](https://forums.balena.io/t/dynamic-container-launches/367564 "2023-04-07T02:33:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ttarhan](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ttarhan/32/8893_2.png) [@ttarhan](https://forums.balena.io/u/ttarhan)\
**Post date:** [April 7, 2023, 2:33am UTC](https://forums.balena.io/t/dynamic-container-launches/367564/1 "2023-04-07T02:33:31Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ttarhan](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/ttarhan/32/8893_2.png) [@ttarhan](https://forums.balena.io/u/ttarhan)\
**Post date:** [April 13, 2023, 10:09pm UTC](https://forums.balena.io/t/dynamic-container-launches/367564/2 "2023-04-13T22:09:35Z")

</div>

Hello - any help here by chance?! Thanks!

---

<div class="post-metadata">

**Author:** ![alanb128](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/alanb128/32/2839_2.png) [@alanb128](https://forums.balena.io/u/alanb128)\
**Post date:** [April 14, 2023, 1:48am UTC](https://forums.balena.io/t/dynamic-container-launches/367564/3 "2023-04-14T01:48:13Z")

</div>

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](https://docs.balena.io/reference/supervisor/supervisor-api/#post-v2applicationsappidstart-service) - 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](https://forums.balena.io/t/stopped-containers-keep-restarting/329650/18))  
Approximately how many containers in total are you contemplating?

---

<div class="post-metadata">

**Author:** ![Langhalsdino](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/langhalsdino/32/3039_2.png) [@Langhalsdino](https://forums.balena.io/u/Langhalsdino)\
**Post date:** [April 14, 2023, 10:19am UTC](https://forums.balena.io/t/dynamic-container-launches/367564/4 "2023-04-14T10:19:11Z")

</div>

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.

> **[GitHub - balena-io-experimental/balena-gitlab-runner: Gitlab Runner as a...](https://github.com/balena-io-experimental/balena-gitlab-runner)**
>
> Gitlab Runner as a balena application. Contribute to balena-io-experimental/balena-gitlab-runner development by creating an account on GitHub.
