title: Docker cp not overwriting files
body: <p>I would like to run a few tests inside docker and therefore load my updated code inside an existing container to save on rebuilding the image all the time.</p>
  
  <p><code>docker cp</code> seems to be an ideal solution for this – but it does not seem to overwrite my existing files, here is a short test I did. I created a new file locally, copied it into my container, changed the file locally, copied it again and compared the contents of the file before and after changing on the container.</p>
  
  <pre><code>&gt;&gt; touch test123
  &gt;&gt; docker cp test123 my-container:/
  &gt;&gt; docker exec my-container cat /test123
  (empty)
  &gt;&gt; vi test123
  (add some text on my local machine)
  &gt;&gt; docker cp test123 my-container:/
  &gt;&gt; docker exec my-container cat /test123
  (empty)
  &gt;&gt; vi test123
  (check if the content was saved –&gt; yes)
  </code></pre>
  
  <p>As we can see the changes have not been copied. The same happens when copying the whole folder (what I actually plan to do). The <a href="https://docs.docker.com/engine/reference/commandline/cp/#parent-command" rel="noreferrer">Docker Docs</a> says: <code>DEST_PATH exists and is a file the destination is overwritten with the source file’s contents</code>, so I am wondering what I am doing wrong here.</p>
  
  <p>The Docker image of the container is based on <code>ubuntu:16.04</code>.</p>
  
  <p>Help is really appreciated here.</p>