Can't create a docker image for COPY failed: stat /var/lib/docker/tmp/docker-builder error

EdoBen picture EdoBen · Oct 24, 2017 · Viewed 92.2k times · Source

I want to create a docker image. This is my work directory: Dockerfile.in test.json test.py

And this is my Dockerfile:

COPY ./test.json /home/test.json
COPY ./test.py /home/test.py

RUN python test.py

When i launch this command: docker build -f Dockerfile.in -t 637268723/test:1.0 .

It gives me this error:

`Step 1/5 : COPY ./test.json /home/test.json
 ---> Using cache
 ---> 6774cd225d60
 Step 2/5 : COPY ./test.py /home/test.py
 COPY failed: stat /var/lib/docker/tmp/docker-builder428014112/test.py: 
 no such file or directory`

Can anyone help me?

Answer

Ivan Lee picture Ivan Lee · Apr 22, 2018

You should put those files into the same directory with Dockerfile.