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.
docker cp
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.
>> touch test123
>> docker cp test123 my-container:/
>> docker exec my-container cat /test123
(empty)
>> vi test123
(add some text on my local machine)
>> docker cp test123 my-container:/
>> docker exec my-container cat /test123
(empty)
>> vi test123
(check if the content was saved –> yes)
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 Docker Docs says: DEST_PATH exists and is a file the destination is overwritten with the source file’s contents
, so I am wondering what I am doing wrong here.
The Docker image of the container is based on ubuntu:16.04
.
Help is really appreciated here.
Docker released an update recently that fixed the issue. I ran the same procedure after updating (new version is 17.12.0-ce-mac55
) and the overwriting worked now.
It was probably an issue with macOS High Sierra and the new file system APFS. The update mentioned that it fixed an issue Disk/image corruption with large numbers of files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With