title: Does Docker purge old/unused images?
body: <p>Many organizations are using Docker specifically for the advantage of being able to seamlessly roll back deployed software. For instance, given an image called <code>newapi</code>, deployment looks like this:</p>
  
  <pre><code># fetch latest
  docker pull newapi:latest
  # stop old one and terminate it
  docker stop -t 10 newapi-container
  docker rm -f newapi-container
  # start new one
  docker run ... newapi:latest
  </code></pre>
  
  <p>If something goes wrong, we can revert back to the previous version like this:</p>
  
  <pre><code>docker stop -t 10 newapi-container
  docker rm -f newapi-container
  docker run ... newapi:0.9.2
  </code></pre>
  
  <p>The problem becomes that over time, our local Docker images index will get <em>huge</em>. Does Docker automatically get rid of old, unused images from its local index to save disk space, or do I have to manually manage these?</p>