I have a critical container application which task consist of polling sensors and taking consequent action on some external hardware.
If the application of the container crashes it's fine. restart: always
will take care of this.
However if the application hangs, possibly blocked on IO or another unexpected event, this is where things can go wrong as the external hardware will get stuck in it's state possibly indefinitely.
I'd like my container application to periodically communicate with something and if it stops doing so, the container gets restarted.
Does this kind of mechanism exists?
I'm running the container with Docker.