Add option to permanently stop/disable containers

When a device is rebooted or balena systemd service is restarted, all containers are started, even if they were stopped manually.

In some cases it may make sense to permanently disable services if they are not used. Some examples: web server used only for occasional database access, containers providing device drivers, containers used for network troubleshooting, containers providing connection to smart devices or other services, …

There are cases that a service needs to be run only on-demand (e.g. for network troubleshooting) or that a service is part of a release deployed to whole fleet, but only some of the fleet devices use that service (e.g. device drivers).

Being able to permanently disable unused containers would ease up some system resources and could provide better security and stability.

Chris Crocker-White: Does the ‘restart’ option in docker-compose help here? Balena defaults it to ‘always’ but you could set it to ‘no’. docker-compose.yml fields | balena

In my setup a way to temporarily disable a container on a per device bases in a fleet would be really great. The “restart” value in docker-compose should be temporarily rewritten by this option. The restart behaviour for the other devices would stay the same. This would enable e.g. disabling a container, if there is an issue on certain devices or environments without touching docker-compose, which would otherwise affect the whole fleet.

I think restart: no doesn’t work through a reboot as balena starts it again after a reboot?