I'm running a small backend with two docker containers in Container Optimised OS. After a couple of weeks, one of the containers got to a weird state - which broke the backend and I had to restart it manually.
To prevent this from happening in the future, I wanted to create a cron job which would do the same thing (docker restart
) every day. However, that is not something I can do in the Container Optimised OS as there is no cron nor a package manager.
Is there a way of periodically restarting containers?
I know it's not an optimal solution, but it would help until I find a proper one.
Also, I've got a health check setup in google cloud. If the health check could run the restart when it detects an issue, that would be nice too.
Ideally, I'd like to implement both the periodical and the healt-check driven restart.