title: Why can't I CTRL-C a sleep infinity in docker when it runs as PID 1
body: <p>Case: we have a docker container that runs a bash script that needs to "block" forever (because it exposes a volume for another container, but there are other reasons why we sometimes want this).</p>
  
  <p>I thought this could work then:</p>
  
  <pre><code>exec sleep infinity;
  </code></pre>
  
  <p>ps aux then gives "sleep" as PID 1. Great, I thought, then it will receive signals we send it from outside the container. For example:</p>
  
  <pre><code>docker kill -s INT container_name
  </code></pre>
  
  <p>But that doesn't work, container keeps running (also for SIGTERM). A normal kill does work, but I don't understand why there's a difference (which annoys me greatly):</p>
  
  <pre><code>docker kill container_name
  </code></pre>
  
  <p>Why can't I kill "sleep" with SIGINT/SIGTERM when it runs as PID 1 in my container? I believe I can kill other things (like bash scripts) with SIGINT/SIGTERM when they run as PID 1 in a container.</p>