0

The documentation for docker stop command says that it sends SIGINT, and after configurable amount of time, SIGKILL.

According to PostgreSQL shutdown documentation, SIGINT is the gracest way to stop, waiting infinitely for all running sessions to terminate. SIGTERM will cause all sessions to terminate immediately, which can cause data lost.

Therefore I'd like to customize the docker stop process, by first sending SIGINT signal, then after a period of time of my choice send SIGTERM, and only if SIGTERM won't terminate the server withing given time, SIGKILL.

I don't want to issue SIGTERM at the begin, giving the chance to running transactions to terminate, but I don't want to SIGKILL server because some session was hanging...

Is it possible to configure docker stop process to intruduce 3rd step (SIGTERM)?

  • I would suggest not. Probably better to exec a command on the container to stop the PostgreSQL process and then issue docker stop. – Raman Sailopal Oct 4 '17 at 13:27
  • @RamanSailopal it is a good point, however, when running containers in OpenShift etc., then those tools issue docker stop command, so ability to custimize its behavior would be a big advantage... – 9ilsdx 9rvj 0lo Oct 4 '17 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.