本文介绍了Tilde扩展在Docker COPY命令中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have a Dockerfile with the following line:

COPY *.zip ~user1

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

The user user1 already exists and has a home directory (i.e. /home/user1). The goal, of course, is to copy the zip file into that user's home dir, however the result of the above is that the zip file is copied to a file named literally /~user1 in the image.

以下功能确实可以正常工作:

The following does work as expected:

COPY *.zip /home/user1

这是Docker中的错误还是我不知道与波浪号扩展有关的限制

Is this a bug in Docker or is there a limitation related to tilde expansion that I'm not aware of?

在Mac上使用Docker 1.13.0。

Using Docker 1.13.0 on Mac.

推荐答案

不支持 COPY 的字幕扩展。

来自:

示例:

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

这篇关于Tilde扩展在Docker COPY命令中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 22:33
查看更多