# Unable to run container after custom initsystem

**URL:** <https://forums.balena.io/t/unable-to-run-container-after-custom-initsystem/15453>\
**Category:** balenaOS\
**Created:** [June 17, 2019, 1:34pm UTC](https://forums.balena.io/t/unable-to-run-container-after-custom-initsystem/15453 "2019-06-17T13:34:50Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![tenvinc](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@tenvinc](https://forums.balena.io/u/tenvinc)\
**Post date:** [June 17, 2019, 1:34pm UTC](https://forums.balena.io/t/unable-to-run-container-after-custom-initsystem/15453/1 "2019-06-17T13:34:50Z")

</div>

My application requires me to use systemd to control daemons within the container. After looking through the documentation, I chanced upon a way to do that by specifying some things within a Dockerfile, and adding a resin.service and a entry.sh based on  
[initsystem for stretch](https://github.com/balena-io-library/base-images/tree/master/examples/INITSYSTEM/systemd/systemd.v230)  
A dockerfile.template was used instead specifying “FROM balenalib/%%BALENA\_MACHINE\_NAME%%-debian:stretch-run” instead. However, the container appears to be installed but not running.  
Please assist, I have no idea why it is doing that.

---

<div class="post-metadata">

**Author:** ![mikesimos](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/mikesimos/32/1418_2.png) [@mikesimos](https://forums.balena.io/u/mikesimos)\
**Post date:** [June 17, 2019, 2:08pm UTC](https://forums.balena.io/t/unable-to-run-container-after-custom-initsystem/15453/4 "2019-06-17T14:08:37Z")

</div>

Hello @tenvinc ! An init system into most of the balena base images listed [here](https://www.balena.io/docs/reference/base-images/base-images/). You can check out an example for using [`INITSYSTEM on`](https://www.balena.io/docs/learn/develop/dockerfile/#init-system) envvar in use, here [https://github.com/balena-io-projects/boombeastic/blob/v2.0.1/spotify](https://github.com/balena-io-projects/boombeastic/blob/v2.0.1/spotify) . Cheers!

---

<div class="post-metadata">

**Author:** ![tenvinc](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@tenvinc](https://forums.balena.io/u/tenvinc)\
**Post date:** [June 17, 2019, 3:42pm UTC](https://forums.balena.io/t/unable-to-run-container-after-custom-initsystem/15453/6 "2019-06-17T15:42:09Z")

</div>

Thanks for the quick reply:) I have tried editing it according to the link you sent, but the container still does not run. It simply starts and says it is installed without running, even though the same Dockerfile without the systemd segment ran perfectly fine.

---

<div class="post-metadata">

**Author:** ![chrisys](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/chrisys/32/1731_2.png) [@chrisys](https://forums.balena.io/u/chrisys)\
**Post date:** [June 17, 2019, 6:08pm UTC](https://forums.balena.io/t/unable-to-run-container-after-custom-initsystem/15453/7 "2019-06-17T18:08:51Z")

</div>

@tenvinc are you able to share your Dockerfile? It would be handy too if you could enable support access and share the URL for the device in question so we can take a look.

---

<div class="post-metadata">

**Author:** ![tenvinc](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@tenvinc](https://forums.balena.io/u/tenvinc)\
**Post date:** [June 18, 2019, 12:40am UTC](https://forums.balena.io/t/unable-to-run-container-after-custom-initsystem/15453/10 "2019-06-18T00:40:17Z")

</div>

[@chrisys](https://forums.balena.io/u/chrisys) Thanks for the quick reply. I have just sent a pm to you regarding the files you need. Thanks 🙂

---

<div class="post-metadata">

**Author:** ![nghiant2710](https://avatars.discourse-cdn.com/v4/letter/n/90db22/32.png) [@nghiant2710](https://forums.balena.io/u/nghiant2710)\
**Post date:** [June 18, 2019, 10:54am UTC](https://forums.balena.io/t/unable-to-run-container-after-custom-initsystem/15453/14 "2019-06-18T10:54:56Z")

</div>

Hey @tenvinc, can you please share your device with us and grant support access? I don’t see anything wrong with your systemd setup so I want to have a look into your application container.

---

<div class="post-metadata">

**Author:** ![tenvinc](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@tenvinc](https://forums.balena.io/u/tenvinc)\
**Post date:** [June 18, 2019, 11:57am UTC](https://forums.balena.io/t/unable-to-run-container-after-custom-initsystem/15453/17 "2019-06-18T11:57:19Z")

</div>

@nghiant2710 Noted. The support access time must have expired. I have enabled the support access and sent you the link. Thank you.

---

<div class="post-metadata">

**Author:** ![hedss](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/hedss/32/210_2.png) [@hedss](https://forums.balena.io/u/hedss)\
**Post date:** [June 18, 2019, 1:40pm UTC](https://forums.balena.io/t/unable-to-run-container-after-custom-initsystem/15453/24 "2019-06-18T13:40:02Z")

</div>

Hi @tenvinc,

Apologies, I think some of the information you received earlier was incorrect. We no longer support the INITSYSTEM flag in our current balenalib base images. However, there is a working example of how to install systemd into a service and then run it here: [https://github.com/balena-io-playground/avahi-zoo-publisher](https://github.com/balena-io-playground/avahi-zoo-publisher)

This particular example uses a docker-compose.yml file to set up capabilities to run systemd within the container.

Best regards, Heds

---

<div class="post-metadata">

**Author:** ![tenvinc](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@tenvinc](https://forums.balena.io/u/tenvinc)\
**Post date:** [June 18, 2019, 1:48pm UTC](https://forums.balena.io/t/unable-to-run-container-after-custom-initsystem/15453/26 "2019-06-18T13:48:20Z")

</div>

Thanks for the quick reply. I see, so the INITSYSTEM flag is no longer supported. Could that be causing the container not to run? Also, currently I am running a single container on balenaOS so does docker-compose.yml still apply and how can I use it in a single-container?

---

<div class="post-metadata">

**Author:** ![hedss](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/hedss/32/210_2.png) [@hedss](https://forums.balena.io/u/hedss)\
**Post date:** [June 18, 2019, 1:53pm UTC](https://forums.balena.io/t/unable-to-run-container-after-custom-initsystem/15453/27 "2019-06-18T13:53:02Z")

</div>

Hi again. Setting the flag shouldn’t be causing the container not to run, but I suspect what may be happening is that it’s retrying so quickly that it appears it’s not running. If `systemd` is being used as the init process and it can’t start (and it probably can’t), then this is what you’d see. I’d recommend ensuring the project I’ve pointed to works for you, and then seeing if it’ll work in single container mode (it should, as the container will be privileged and essentially have all the required options set).

---

<div class="post-metadata">

**Author:** ![tenvinc](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@tenvinc](https://forums.balena.io/u/tenvinc)\
**Post date:** [June 18, 2019, 2:31pm UTC](https://forums.balena.io/t/unable-to-run-container-after-custom-initsystem/15453/29 "2019-06-18T14:31:41Z")

</div>

[@hedss](https://forums.balena.io/u/hedss) Yup, it works with the example project that you sent me. I will try to incorporate this into my own system, now that I have an idea of what works and what doesn’t . Thanks so much for the support. Loving balenaOS so far ![:smile:](https://global.discourse-cdn.com/balena/original/2X/4/45be53232e7145eb06955fa6140139e3a8cdd221.png ":smile:")

---

<div class="post-metadata">

**Author:** ![hedss](https://sea2.discourse-cdn.com/balena/user_avatar/forums.balena.io/hedss/32/210_2.png) [@hedss](https://forums.balena.io/u/hedss)\
**Post date:** [June 18, 2019, 2:42pm UTC](https://forums.balena.io/t/unable-to-run-container-after-custom-initsystem/15453/30 "2019-06-18T14:42:00Z")

</div>

Hey @tenvinc,

Great, really glad we could help you! Let us know if you have any other issues/questions. 🙂

Best regards, Heds
