dockerdockerfiledocker-copy

Docker add no such file or directory


The following is my root-directory:

andrej:
  - docker/CodeExperiments.jar
  - docker2/Dockerfile

Here are the contents of my Dockerfile:

FROM java:8
ADD docker/CodeExperiments.jar docker/
RUN javac BirthDayTask.java

And this is the command I am running:

docker build -t newfile docker2

Which results in the following error message:

ADD failed: stat /var/lib/docker/tmp/docker-builder946291442/docker/CodeExperiments.jar: no such file or directory

What am I doing wrong?


Solution

  • CodeExperiments is located in docker folder while Dockerfile is located in docker2.

    Place them both in the same folder or at least place CodeExperiments in a child folder of the Dockerfile and reference from there.