RUnit does not stop docker-compose's containers

I would like to have a RUnit service to supervise a set of containers launched by docker-compose tool, here’s my the runit script:

In /etc/sv/app/run

  • why I can't ping my docker container?
  • Cannot start docker after installation on Windows
  • Inter process communication in Docker Container
  • Sbt-native-packager & AutoPlugin & Mappings in Docker
  • Docker Compose and execute command on starting container
  • Show python logs in docker-compose log
  • #!/bin/bash
    exec 2>&1
    source $APP_HOME/
    exec docker-compose -f $APP_HOME/docker-compose.yml up

    Here’s what I have then:

    • sv start app – launches the docker-compose thing just fine
    • sv stop app – stops docker-compose process itself but for unknown reason it leaves the containers running

    Is there any chance to have the stop command to stop containers as well? I thought that is what docker-compose should do when it gets stopped by RUnit.

  • docker container does not mount content of mapped volume on start
  • Binaries inside Docker container images not being started when not explicitly called
  • Which java 8 docker image contains jmap?
  • Laravel installed on a local volume (Mac) from docker nginx/php-fpm can't write session files
  • Make Docker4Mac and vagrant see each others network
  • Docker error: exit status 255
  • One Solution collect form web for “RUnit does not stop docker-compose's containers”

    I’m not familiar with docker (yet) but I have familiarity with runit.

    When you issue sv stop app you are actually telling runsvdir to signal the runsv for your docker launch to tear down the process. If you need something to signal the container to shut down, it won’t happen because runsv will haul off and kill any child processes that are attached. You may wish to read up on ./finish scripts, which are tasked with cleaning up things.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.