title: Why does Docker run --rm option not work if port is already bound?
body: <pre><code>$ docker rm containername
  containername
  </code></pre>
  
  <p>Then I tried to run a container and assigned it a name <code>containername</code></p>
  
  <pre><code>docker run -it --rm -p 8080:8080 --name containername b014d35f03a
  FATA[0000] Error response from daemon: Cannot start container 2dc7aa98e8213625352e0ef8aadeaa1b6b4a0ab92c6c64c4dafe870b5bb7a49e: Bind for 0.0.0.0:8080 failed: port is already allocated 
  </code></pre>
  
  <p>Why is Docker now saying that <code>containername</code> is taken? Shouldn't it have removed the container when it exits since I put in <code>--rm</code>? And is there a way to fix this problem? (Always remove container when any exiting)</p>
  
  <pre><code>$ docker run -it --rm -p 8080:8080 --name containername b014d35f03a
  FATA[0000] Error response from daemon: Conflict. The name "containername" is already in use by container 2dc7aa98e821. You have to delete (or rename) that container to be able to reuse that name.
  </code></pre>