Gracefully stopping Kong in Docker


We are using kong in docker, but docker stop command cause requests to fail before they finish executing.

Is there a recommended way to make the docker stop command to call kong quit (kong’s graceful shutdown), instead of kong stop?

Or in different words - did anyone implement graceful shutdown using kong in docker?

docker stop is hardcoded to send a SIG_TERM signal to the main process which in the case of Kong is nginx. nginx interpretes SIG_TERM as a “fast shutdown”.

My recommendation would be using something other than the “raw” docker stop. For example, a file which would ssh into the running docke and send the QUIT signal to Kong.

Hi, thanks for the reply!

Unfortunately that won’t be possible, since we are running our docker-kong in DCOS, and the way deployments work in DCOS is by sending SIGTERM to containers when they are undeployed.

Currently we are exploring the possibility of intercepting the signal in the docker, but would rather avoid it.