ERROR: Cannot locate specified Dockerfile: Dockerfile

This happens if you mv or copy docker-file from another location. Try just to rename it even if it's Dockerfile already

mv Dockerfile Dockerfile

It appears that Dockerfile.dev is not recognized by Docker hence the message:

ERROR: Cannot locate specified Dockerfile: Dockerfile

It's looking for a Dockerfile not a Dockerfile.dev.

When I tried mv Dockerfile.dev Dockerfile and then ran docker-compose up, it worked as expected.


Error:

ERROR: Cannot locate specified Dockerfile: Dockerfile

Explanation: In short, Your docker can not locate the docker file which is case sensitive, it perhaps because its not written correctly (some bad examples :DockerFile , dockerfile, Dockerfile.txt , .DockerFile etc...). another option might related to the file location not in the correct path.

Solution: Rename the Dockerfile (The correct spell is Dockerfile) an d make sure you're running it in the project location.

For example:

cd ~/<projectPath>
ls -la
#Relevant files Validation
#drwxr-xr-x  7 myUser  staff  224 Dec 18 11:38 ..
#-rw-r--r--  1 myUser  staff  312 Dec 18 11:40 Dockerfile
#-rw-r--r--  1 myUser  staff  224 Dec 18 11:38 app.py
docker build .

Tags:

Docker