Unable to run container after custom initsystem

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
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.

Hello @tenvinc ! An init system into most of the balena base images listed here. You can check out an example for using INITSYSTEM on envvar in use, here https://github.com/balena-io-projects/boombeastic/blob/v2.0.1/spotify . Cheers!

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.

@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.

@chrisys Thanks for the quick reply. I have just sent a pm to you regarding the files you need. Thanks :slight_smile:

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.

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

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

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

Best regards, Heds

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?

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).

@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:

Hey @tenvinc,

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

Best regards, Heds