I have set up a Kippo server to run in a docker container. Everything runs fine,until you kill the container. Killing the container(by restarting the machine or through docker kill) makes it unusable with STDERR "Another twistd server is running, PID 1". How can I solve this problem? I don't have issues to reset the file system of the container or something like this because everything I want is logged to a database. Thank you very much
Within Docker, each container runs in its own PID namespace. This means that the process started by the dockerfile will always be PID 1, and PIDs will count upwards from there.
twistd
expects that PIDs are non-deterministic enough that it can check to see if another twistd
is "already running" by simply comparing to see if the PID is the same. Since, in Docker, the PID will always be 1, this check always succeeds, and twistd
thinks it shouldn't start up. If the container exits un-cleanly, twistd
won't get the opportunity to clean up its .pid
file, and the state will be preserved within the container's filesystem.
Since the Docker daemon will namespace containers and prevent two matching twistd
processes from starting up at the same time anyway, the .pid
file and its related checking is not actually useful at all, so you should disable it. You can disable it by changing your command line to include the --pidfile=
option (exactly as such, nothing after the "=
") before the plugin name. I'm not familiar with Kippo, but for twistd web
this would be twistd --pidfile= web
.
I hope that this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With