title: How to turn a docker container to a zombie
body: <p>A few years ago. When I just started playing docker. I remember there are some blog posts mentioned if you don't handle your pid(1) process well. You will create a zombie docker container. At that time. I chose just follow the suggestion start using a init tool called <a href="https://github.com/Yelp/dumb-init" rel="nofollow noreferrer">dumb-init</a>. And I never really see a zombie container be created.</p>
  
  <p>But I am still curious why it's a problem. If I remember correctly, <code>docker stop xxx</code> by default will send <code>SIGTERM</code> to the container pid(1) process. And if the process can not gracefully stop within 10s (default). Docker will force kill it by sending <code>SIGKILL</code> to pid(1) process. And I also know that pid(1) process is special in Linux system. It can ignore <code>SIGKILL</code> signal (<a href="https://unix.stackexchange.com/questions/7441/can-root-kill-init-process">link</a>). But I think even if the process's PID in docker container is 1. It just because it's using namespaces to scope its processes. In the host machine, you should see the process is another PID. Which can be killed by the kernel.</p>
  
  <p>So my questions are:</p>
  
  <ol>
  <li>Why can't docker engine just kill the container in the host kernel level? So no matter what. The user can ensure the container be killed properly.</li>
  <li>How can I create a zombie process in docker container? (If someone can share a Gist will be great!)</li>
  </ol>