title: How do I avoid crushing Docker with too many containers?
body: <p><strong>My Story</strong></p>
  
  <p>Once upon a time I was calling <a href="http://docker.com" rel="nofollow">Docker</a> from a PHP laravel queue to process thousands of media files.  My code would create a new container for each task I wanted to complete (e.g. "process", "search", "slice" etc).  Then I went to bed and disaster struck.  I woke up to a 1TB log file, and a few hundred thousand containers in various states.</p>
  
  <p>Docker doesn't work any more.  As in, when I type <code>docker version</code> (or <code>docker anything</code> for that matter) it just sits there and stares.  I would like to avoid reinstalling, but I can't remove the containers through the standard <code>docker rm $(docker ps -a -q)</code> because Docker has become very, very depressed.</p>
  
  <p><strong>My Questions</strong></p>
  
  <ol>
  <li><p>How can I remove docker containers if the docker daemon isn't responding?</p></li>
  <li><p>My code is using Docker as a glorified executable using the docker API.  What extra steps do I need my code take to clean after itself in future?</p></li>
  <li><p>In general I have noticed that when I try to spin up too many (i.e. 20) containers at the same time, Docker was prone to timing out.  I would love to be able to crank that dial up.</p></li>
  </ol>
  
  <p><strong>Some Information</strong></p>
  
  <p>Here's how I'm currently calling the daemon:</p>
  
  <pre><code>$&gt; sudo docker daemon
  INFO[0000] API listen on /var/run/docker.sock
  INFO[0000] [graphdriver] using prior storage driver "aufs"
  
  (Meanwhile in another terminal)
  $&gt; docker version
  (insert infinite darkness here)
  </code></pre>