Docker cp 不覆盖文件

Dep*_*ify 7 docker

我想在 docker 中运行一些测试,因此将我更新的代码加载到现有容器中,以节省始终重建图像的时间。

docker cp似乎是一个理想的解决方案 - 但它似乎不会覆盖我现有的文件,这是我做的一个简短测试。我在本地创建了一个新文件,将其复制到我的容器中,在本地更改了文件,再次复制并比较了在容器上更改前后文件的内容。

>> 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)
Run Code Online (Sandbox Code Playgroud)

如我们所见,更改尚未被复制。复制整个文件夹时也会发生同样的情况(我实际打算这样做)。该码头工人文档说:DEST_PATH exists and is a file the destination is overwritten with the source file’s contents,所以我想知道我在这里做错了。

容器的 Docker 镜像基于ubuntu:16.04.

在这里非常感谢帮助。

Dep*_*ify 6

Docker 最近发布了一个更新来解决这个问题。更新后我运行了相同的程序(新版本是17.12.0-ce-mac55),现在覆盖工作了。

这可能是 macOS High Sierra 和新文件系统 APFS 的问题。该更新提到它修复了一个问题Disk/image corruption with large numbers of files