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?

  • Dockerfile vs on AWS Elastic Beanstalk
  • Selenium Hub Node with Docker containers on different hosts
  • How can I extend unregistered docker images or dockerfiles?
  • custom docker image is not running postgres
  • Configuration of Angular2 application - nginx and docker
  • How to set up etheruem nodes using docker?
  • Docker Pull Python
  • Using environment variables post docker container linking in java
  • Safe delete docker tmp folder
  • chowning a docker folder from dockerfile
  • Kubernetes v1.2.2 api-server dosen't start
  • Docker tools Error while recreating Hostonly network
  • 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
        # run your clean-up here
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.