Infinite Restarts of docker container

I have got the problem that I need to use Ubuntu 16.04 as docker image for my application because of some package dependencies and proprietary software.
So I am sadly not able to rely on the resin base images.

I have now got everything setup from the docker side using armv7/armhf-ubuntu:xenial as image.
But now my service/container exits every time immediately after executing.
From my point of view this comes from the INITSYSTEM which is not enabled because I am not using a resin base image.
What would be the best way or alternative to get the same behaviour as when using the INITSYSTEM?

This is the output in the console just to show what I mean:
14.03.18 17:56:14 (+0100) main Hello, world!
14.03.18 17:57:17 (+0100) main Hello, world!
14.03.18 17:58:18 (+0100) main Hello, world!
14.03.18 17:58:19 (+0100) Service exited ‘main sha256:c8c025f0fa851ce6cda70859c367ea7113d47176f63d5f66623ff43f374460cf’
14.03.18 17:59:20 (+0100) Restarting service ‘main sha256:c8c025f0fa851ce6cda70859c367ea7113d47176f63d5f66623ff43f374460cf’
28.02.18 07:08:46 (+0100) main Hello, world!
28.02.18 07:08:49 (+0100) main Hello, world!
28.02.18 07:08:51 (+0100) main Hello, world!

Hello,
have you tried enabling the init system either in the Dockerfile or via the Dashboard as described here? https://docs.resin.io/learn/develop/dockerfile/#init-system

Otherwise, you should keep your process running. The container exits because the main process exits. So, I’d suggest you keep your program alive somehow.

Yes this is enabled.

It works after just adding while(true) loop although I wouldn’t need it but that seems ok for me.

@Sebi55 - indeed, the easiest way is to just keep your process running, which sometimes you can achieve by wrapping your process in a start script that just loops infinitely at the end. If you really want to replicate what INITSYSTEM does, you’d need to run systemd inside the ubuntu container - which could be really hard or really easy. It might help to look at how are debian images achieve this: https://github.com/resin-io-library/base-images/blob/master/debian/entry.sh#L70 but I guess ubuntu may be a bit different.

Also looking at this image might help https://hub.docker.com/r/solita/ubuntu-systemd/~/dockerfile/ (haven’t tried it though)