title: Keep alpine container running but handle SIGTERM gracefully
body: <p>For testing purposes I'm starting a alpine container using <code>docker-compose</code> like this:</p>
  
  <pre><code>version: '2'
  
  services:
    alpine:
      image: alpine:3.7.3
      container_name: compose_test_alpine
  </code></pre>
  
  <p>I want to keep the container running in the background, so I'm using this <code>command</code> for the <code>alpine</code> <code>service</code>:</p>
  
  <pre><code>version: '2'
  
  services:
    alpine:
      image: alpine:3.7.3
      command: 'tail -f /dev/null'
      container_name: compose_test_alpine
  </code></pre>
  
  <p>When calling <code>docker-compose down</code> or <code>docker-compose kill</code> now I get a <a href="https://success.docker.com/article/what-causes-a-container-to-exit-with-code-137" rel="nofollow noreferrer">non zero exit code</a>:</p>
  
  <pre><code>compose_test_alpine exited with code 137
  </code></pre>
  
  <p>Is there a simple way by means of using a shell script to handle the shutdown gracefully resulting in exit code <code>0</code>?</p>