Docker Community Forums

Share and learn in the Docker community.

How can I detect when a docker container has crashed?

(Kyrax80) #1

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?


(Caldarolad) #2

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.