COPYing a file in a Dockerfile, no such file or directory?
It is possibly caused by you are referring file1
/file2
/file3
as an absolute path which is not in build context, Docker only searches the path in the build context.
E.g. if you use COPY /home/yourname/file1
, Docker build interprets it as ${docker build working directory}/home/yourname/file1
, if no file with the same name here, no file or directory error is thrown.
Refer to One of the docker issue
Do check the .dockerignore
file too.
I know this is a very rare case, but I had that file mentioned there.
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.
Refer Dockerfile Doc
Also the command for building the Dockerfile
should be something like.
cd into/the/folder/
docker build -t sometagname .