Starman and Docker

Toby Wintermute tjc at wintrmute.net
Thu Jul 17 04:10:14 BST 2014


Hi,
I have a problem with Starman when run inside a Docker container.
Well, rather, it runs just fine - but doesn't want to die neatly.

I can Ctrl-C the running docker container, or send it a SIGTERM or
SIGKILL, and the docker process returns me to a command prompt.. but
the container lives on!

To demonstrate, get a container with perl and starman installed[1],
and put this "hello.psgi" into the root:
  my $app = sub {
    return [
      '200',
      [ 'Content-type' => 'text/plain' ],
      [ "Hello world" ]
    ];
  };

Then launch it with:
docker run --rm -t -p 5000:5000 my_container starman /mini.psgi

Try requesting http://localhost:5000 and you'll get back "Hello world".

Now Ctrl-C the running docker. Wait a second, and try querying that
URL again -- still hello world!
"docker ps" will show the container is still running.


This is probably *not* a Starman bug, but I did wonder if anyone has
encountered this and come up with a neat solution?

Cheers,
Toby


Note 1 -- to do this, you probably want to run something like:
$ docker run -t -i ubuntu:trusty /bin/bash
# apt-get update
# apt-get -y install starman
(exit with Ctrl-D)
$ docker commit a1b2c3d4e5 my_container           (replacing the
hexcode with the container id that was printed when you ran it just
before)


More information about the london.pm mailing list