gpt4 book ai didi

docker - 波浪号扩展在 Docker COPY 命令中不起作用

转载 作者:IT老高 更新时间:2023-10-28 21:25:16 26 4
gpt4 key购买 nike

我有一个带有以下行的 Dockerfile:

COPY *.zip ~user1

用户 user1 已经存在并且有一个主目录(即 /home/user1)。当然,目标是将 zip 文件复制到该用户的主目录中,但是上面的结果是将 zip 文件复制到图像中字面上命名为 /~user1 的文件中。

以下内容按预期工作:

COPY *.zip /home/user1

这是 Docker 中的一个错误,还是存在我不知道的与波浪号扩展相关的限制

在 Mac 上使用 Docker 1.13.0。

最佳答案

COPY 的波浪号扩展不受支持。

来自 The COPY docs :

The dest is an absolute path, or a path relative to WORKDIR, into which the source will be copied inside the destination container.

例子:

COPY test relativeDir/   # adds "test" to `WORKDIR`/relativeDir/
COPY test /absoluteDir/ # adds "test" to /absoluteDir/

关于docker - 波浪号扩展在 Docker COPY 命令中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41927249/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com