I run this:
➜ frontend git:(master) ✗ docker-compose up
Building web
ERROR: Cannot locate specified Dockerfile: Dockerfile
And I get the error above. This is my directory:
➜ frontend git:(master) ✗ ls
Dockerfile.dev docker-compose.yml package.json src
README.md node_modules public yarn.lock
This is my docker-compose.yml
file:
version: '3'
services:
web:
build:
context: .
dockerfile: Dockerfile.dev
ports:
- "3000:3000"
volumes:
- /app/node_modules
- .:/app
Is it an indentation issue? I know YAML is funny about that.
This is my Dockerfile.dev
:
FROM node:alpine
WORKDIR '/app'
COPY package.json .
RUN npm install
COPY . .
CMD ["npm", "run", "start"]
I am following documentation: https://docs.docker.com/compose/compose-file/#context
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 .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With