Michael Ihde
2016-04-27 19:37:55 UTC
I love using supervisor for many of my programs. Recently I've also been
using supervisor to launch docker containers (i.e. command=docker
run....). This has generally worked very well except for one particular
issue; I like to use the docker --name option to ensure my containers have
the same name as the supervisor jobs. The downside of this is that there
are a variety of corner cases where docker will not auto-delete the
container even if --rm=true is used. When supervisor goes to start the job
it fails because the name is already taken.
Some workarounds would be:
- Don't use --name and simply let the containers get unique UUIDs.
- Build some form of wrapper script for the docker command
- Change the behavior of docker ;-)
Ultimately I decided that it would be nice if supervisor was
"docker-aware". I wanted to make it as an rpcinterface plugin but wasn't
happy with the result because I wanted to include the necessary docker
information within the [program] section and there did not appear to be a
straightforward way to extend the option parser from a plugin.
The alternative was to extend supervisor itself in a manner similar to how
fastcgi support is included in supervisor. I've made the necessary changes
and submitted a pull request, but I see that the Travis CI build was
failing because I used some deprecated Python syntax. I'll go back and fix
up the code so that it passes all the Travis CI tests...but I wanted to see
if this was thought to be a useful enhancement. If not, are there
alternate approaches that would be better?
~Michael
using supervisor to launch docker containers (i.e. command=docker
run....). This has generally worked very well except for one particular
issue; I like to use the docker --name option to ensure my containers have
the same name as the supervisor jobs. The downside of this is that there
are a variety of corner cases where docker will not auto-delete the
container even if --rm=true is used. When supervisor goes to start the job
it fails because the name is already taken.
Some workarounds would be:
- Don't use --name and simply let the containers get unique UUIDs.
- Build some form of wrapper script for the docker command
- Change the behavior of docker ;-)
Ultimately I decided that it would be nice if supervisor was
"docker-aware". I wanted to make it as an rpcinterface plugin but wasn't
happy with the result because I wanted to include the necessary docker
information within the [program] section and there did not appear to be a
straightforward way to extend the option parser from a plugin.
The alternative was to extend supervisor itself in a manner similar to how
fastcgi support is included in supervisor. I've made the necessary changes
and submitted a pull request, but I see that the Travis CI build was
failing because I used some deprecated Python syntax. I'll go back and fix
up the code so that it passes all the Travis CI tests...but I wanted to see
if this was thought to be a useful enhancement. If not, are there
alternate approaches that would be better?
~Michael