How can I detect when a docker container has crashed?

Hello, I am developing a distributed App, for this, I need to detect when a running container has crashed so I can relaunch it or launch another.

Can anyone guide me?

Thanks.

Your best bet is to set a restart policy so it automatically restarts itself. If you want notifications you won’t be able to do that through Docker. You’ll need to create/use monitoring. A very simple example is to create a cron to run docker ps and if you find “Exited” then send an email.