正在复制Dockerfile中的文件,没有这样的文件或目录? [英] COPYing a file in a Dockerfile, no such file or directory?
问题描述
我在根(〜)文件夹中设置了一个Dockerfile。文件的前三行如下所示:
I have a Dockerfile set up in my root (~) folder. The first three lines of my file look like this:
COPY file1 /root/folder/
COPY file2 /root/folder/
COPY file3 /root/folder/
,但它会返回以下错误每行:
but it returns the following error for each line:
没有这样的文件或目录
No such file or directory
文件与我的Dockerfile位于同一目录中,并且我正在运行命令 docker build-< Dockerfile
也位于终端的同一目录中。
The files are in the same directory as my Dockerfile and I am running the command docker build - < Dockerfile
in the same directory in terminal as well.
我到底在做什么错了?
推荐答案
Dockerfile
中的COPY指令将文件复制到 src $ c $中c>到
目的地
文件夹。好像您缺少 file1
, file2
和 file3
或尝试从错误的文件夹构建 Dockerfile
。
The COPY instruction in the Dockerfile
copies the files in src
to the dest
folder. Looks like you are either missing the file1
, file2
and file3
or trying to build the Dockerfile
from the wrong folder.
另外,用于构建 Dockerfile
的命令应该类似于。
Also the command for building the Dockerfile
should be something like.
cd into/the/folder/
docker build -t sometagname .
这篇关于正在复制Dockerfile中的文件,没有这样的文件或目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!