title: How to rebuild and update a container without downtime with docker-compose?
body: <p>I enjoy a lot using docker-compose.</p>
  
  <p>Eg. on my server, when I want to update my app with minor changes, I only need to <code>git pull origin master &amp;&amp; docker-compose restart</code>, works perfectly.</p>
  
  <p>But sometimes, I need to rebuild (eg. I added an npm dependency, need to run <code>npm install</code> again). </p>
  
  <p>In this case, I do <code>docker-compose build --no-cache &amp;&amp; docker-compose restart</code>.</p>
  
  <p>I would expect this to :</p>
  
  <ul>
  <li>create a new instance of my container</li>
  <li>stop the existing container (after the newer has finished building)</li>
  <li>start the new one</li>
  <li>optionally remove the old one, but this could be done manually</li>
  </ul>
  
  <p>But in practice it seems to restart the former one again.</p>
  
  <p>Is it the expected behavior? </p>
  
  <p>How can I handle a rebuild and start the new one <strong>after</strong> it is built?</p>
  
  <p>Maybe I missed a specific command? Or would it make sense to have it?</p>