mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-03-14 08:16:45 +00:00
Allow users to set container restart policy using environment variables. RESIN_APP_RESTART_POLICY sets the name of the policy, and if policy is "on-failure", optionally, RESIN_APP_RESTART_RETRIES sets the maximum number of retries. More information on docker docs: https://docs.docker.com/engine/reference/run/#restart-policies-restart One major change we introduce here is that the default policy is set to always while we used to have the default "no". We validate the arguments and pass retries parameter only for the case of "on-failure" as specified in Docker API as of v1.19. We could let docker handle the arguments directly, gaining forwards-compatibility with any new features, but I opted for an implementation that is as well-defined as possible.