<p>When I ran the KCL as <code>./bin/kcl-bootstrap -p app.properties -j /usr/bin/java -e</code> at the terminal, and then I did <code>ps -ef | grep java</code> and got the pid for it. I issued <code>kill -s TERM $PID_ABOVE</code>. I noticed the node recordProcessor managed to log like this 
<code>2018-03-31T11:13:46.998 INFO recordProcessor - Shutdown requested
2018-03-31T11:13:48.024 INFO recordProcessor - Shutting down...</code></p>

<p>When I ran the equivalent via a docker run command as such 
<code>docker run -v /tmp:/tmp -v ~/.aws:/root/.aws -ti cde3946e2cf9</code>, issuing <code>Ctrl-C</code> or <code>docker stop cde3946e2cf9</code> or <code>docker kill --signal=SIGTERM cde3946e2cf9</code> to terminate the docker didn't result in the logs being produced above. e,g the recordProcessor didn't get notified about the shutdown request. </p>

<p>Our docker is deployed in Kubernetes cluster, and when we are redeploying the docker, I can see that <code>Process terminanted, will initiate shutdown.</code> is being logged by the main processor, but nothing from the worker shutting down request being reported.</p>

<p>I would like to trap these events when re-deploying docker to make sure we handle shutdown gracefully. </p>

<p>Anyone knows how to make sure the worker does get notified when redeploy docker in cluster?</p>

<p>Thanks</p>

<p>For anyone who is facing a similar issue, here are the steps I solved mine:</p>

<p>Add a preStop hook in kubernetes template to execute a shell command
The command is <code>kill -s TERM $(ps -ef | grep "MultiLangDaemon" | grep -v \"grep\" | awk '{print $1}')</code></p>
