Problem with COPY intruction while building docker image with – < Dockerfile

  copy, docker, dockerfile, python

I have 1 folder that contains several dockerfiles, and i want to specify which is the one i want to build.
In this case i’m suposed to use

docker build - < Dockefilename

But it gives me back errors

docker copy failed stat /var/lib/docker/tmp/docker-builder/src/main.py: no such file or directory

But. If leave only one dockerfile in the folder, named "Dockerfile", and build exacly the same dockerfile with

docker build .

It works with no problems.
The error is caused by COPY instruction. While building with – <Dockerfile, i cant copy main.py, while i can do it with docker build .

Edit
It doesn’t matter if the copied files are in the same directory as dockerfile, or not. Error occures anyway.

Source: Docker Questions

LEAVE A COMMENT