title: Avoid docker exec zombie processes when connecting to containers via bash
body: <p>Like most docker users, I periodically need to connect to a running container and execute various arbitrary commands via bash.</p>
  
  <p>I'm using 17.06-CE with an ubuntu 16.04 image, and as far as I understand, the only way to do this without installing ssh into the container is via <code>docker exec -it &lt;container_name&gt; bash</code></p>
  
  <p>However, <a href="https://github.com/moby/moby/issues/9098#issuecomment-312152980" rel="nofollow noreferrer">as is well-documented</a>, for each bash shell process you generate, you leave a zombie process behind when your connection is interrupted. If you connect to your container often, you end up with 1000s of idle shells -a most undesirable outcome!</p>
  
  <p>How can I ensure these zombie shell processes are killed upon disconnection -as they would be over ssh?</p>