# Start container only on demand

**URL:** <https://forums.balena.io/t/start-container-only-on-demand/35330>\
**Category:** Product support\
**Created:** [October 3, 2019, 9:26am UTC](https://forums.balena.io/t/start-container-only-on-demand/35330 "2019-10-03T09:26:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomasn](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/thomasn/32/497_2.png) [@thomasn](https://forums.balena.io/u/thomasn)\
**Post date:** [October 3, 2019, 9:26am UTC](https://forums.balena.io/t/start-container-only-on-demand/35330/1 "2019-10-03T09:26:12Z")

</div>

I am setting up an application for network management which is to be deployed in many different situations. In the different containers I have the management tools for different devices.

Is there any way to make Balena only start one container when the device is powered and then let this container decide which other containers to start?

I know you can start and stop containers from the API, but is it possible to disable “autostart” of the containers on boot?

Thanks,

Thomas

---

<div class="post-metadata">

**Author:** ![karaxuna](https://avatars.discourse-cdn.com/v4/letter/k/e480ec/32.png) [@karaxuna](https://forums.balena.io/u/karaxuna)\
**Post date:** [October 3, 2019, 10:55am UTC](https://forums.balena.io/t/start-container-only-on-demand/35330/2 "2019-10-03T10:55:11Z")

</div>

I don’t know exactly what software you are running on devices, but may I suggest an alternative? Let all containers run with application that listens for the request from other container (maybe http server or something else), when it gets a request it will exec program that you need to run on demand.

---

<div class="post-metadata">

**Author:** ![reinzor](https://avatars.discourse-cdn.com/v4/letter/r/f07891/32.png) [@reinzor](https://forums.balena.io/u/reinzor)\
**Post date:** [October 3, 2019, 4:25pm UTC](https://forums.balena.io/t/start-container-only-on-demand/35330/4 "2019-10-03T16:25:37Z")

</div>

Another usecase would be a VPN client container that does not need to start automatically on startup but only when we trigger it via the Balena API (or web interface). Is this possible?

---

<div class="post-metadata">

**Author:** ![thgreasi](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/thgreasi/32/454_2.png) [@thgreasi](https://forums.balena.io/u/thgreasi)\
**Post date:** [October 3, 2019, 4:59pm UTC](https://forums.balena.io/t/start-container-only-on-demand/35330/5 "2019-10-03T16:59:41Z")

</div>

Hi @reinzor,  
I’m afraid that there isn’t an option currently in the docker-compose to mark containers that shouldn’t be started.  
A way to achieve something like this could be to

- have those containers check on their startup script for a specific application or device tag using the balena API and exit if that’s not set or doesn’t have the excepted value.
- have an “orchestrator” container that also checks for such application or device tags periodically and starts or stops the appropriate containers accordingly.

If you choose to use device tags, then you can use the supervisor API as well for this. Let me point you to the respective documentation page:  
[https://www.balena.io/docs/reference/supervisor/supervisor-api/#device-tags](https://www.balena.io/docs/reference/supervisor/supervisor-api/#device-tags)

Would something like this work for your use case?

Kind regards,  
Thodoris

---

<div class="post-metadata">

**Author:** ![reinzor](https://avatars.discourse-cdn.com/v4/letter/r/f07891/32.png) [@reinzor](https://forums.balena.io/u/reinzor)\
**Post date:** [October 4, 2019, 6:15am UTC](https://forums.balena.io/t/start-container-only-on-demand/35330/7 "2019-10-04T06:15:18Z")

</div>

Thanks for your reply, seems we have to work around this then using another container starting and stopping the desired temporary container.
