Is it possible to have a Supervisord pretask?
I’m currently having Supervisor run some Docker containers for me. This is besides the point, but the thing about Docker is, right now, it doesn’t always clean up after itself. When it doesn’t Supervisord is unable to restart it and eventually goes to
FATAL, and I have to manually go in, run a clean-up script, and then
supervisorctl reload to get things going again.
Now, the clean-up script I have is idempotent, so what would be really great is if there was a way for me to tell supervisor to always run that script before running Docker. Is there a way to do that? Should I just add my
docker run ... command to the end of the script, and have supervisor just run the script? What’s a good solution in this situation?
One Solution collect form web for “Is it possible to have a Supervisord pretask?”
You could run a script triggered by docker events, similar to the one at this question
So, something like:
docker events --filter 'event=start' | while read event do # run your clean-up here done