flynn/flynn-postgres — pull request #6 by miracle2k (2014-05-26 11:23:39+00:00)
Title: Can't get the container to shut down cleanly.

During testing, I've run into this annoying problem frequently:

2014-05-25 20:08:02 UTC FATAL: lock file "postmaster.pid" already exists
2014-05-25 20:08:02 UTC HINT: Is another postmaster (PID 14) running in data directory "/data"?

The process structure looks like this:

647 1 docker /usr/local/bin/docker -d -D -g /var/lib/docker -H unix:// -H tcp://0.0.0.0:4243
16329 647 start-flynn-pos {start-flynn-pos} /bin/bash /bin/start-flynn-postgres postgres
16339 16329 sudo sudo -u postgres -H EXTERNAL_IP=10.0.2.15 PORT=5555 DISCOVERD=192.168.59.103:1111 /bin/flynn-postgres
16340 16339 flynn-postgres /bin/flynn-postgres
16346 16340 postgres /usr/lib/postgresql/9.3/bin/postgres -D /data -p 5555 -h * -l

Starting with 16339, I can do ``kill -s SIGTERM`` and have the container shutdown. Sending SIGTERM to 16329 has no effect - which is why docker stop will do a SIGKILL.

I don't understand what the strange ``{start-flynn-postgres}``syntax means, but I wonder if the reason is the sudo call and the permission boundaries, but Possibly ``exec`` should be used.