More and more applications have manuals telling you to preferrably run it within a docker container. But if you want an application to follow the system runlevels of the linux operating system that your docker container is running on and be controllable with commands like 'sudo service myservice start
' and 'systemctl enable myservice
' then it is much easier to make it a systemd service. Running it without docker can be cumbersome. I could narrow this question to Java Spring Boot Applications because that's my main use case for the applications I write myself, but I would rather come to a more generic approach to do this in a way that it is:
- easy to configure
- survives reboots gracefully
- keeps most or all the advantages of systemd control
Ofcourse there will be reasons why I should not want this approach and I can guess some of the responses that will follow. I am interested in that. Things should be as simple as possible, but not simpler (Einstein something). But describing a simple approach that will work could benefit the Linux and Docker community.
In response to some earlier answers below (thanks for the valuable feedback!): I prefer to control all individual applications on my operating system by one means of control. By default that would be systemd because that's the default of the operating system for that. I know using a container is a bit of a different paradigm then running it on the OS itself, but I don't really know what rule I would be breaking if I would create a systemd service like 'homeassistant-container', that controls starting and stopping a docker container with (in this case) 'homeassistant' as an application within that container