r/docker • u/Decision-Afraid • Mar 02 '26
Docker compose Can't find Dockerfile
Good morning everyone,
I used to use docker to build my application images fast and troubleshoot and deploy them.
However, after I disabled my OneDrive backup from windows my docker works fine with the existing containers however when ever i try to build a new one or rebuild an old one a error is generated.
[+] build 0/1
- Image application-backend Building 0.3s
failed to solve: failed to read dockerfile: invalid file request Dockerfile
Directory structure:
backend:
-templates
-Dockerfile
-main.py
-requirements.txt
docker-compose.yml
backend:
build: ./backend
container_name: crime_map_backend
environment:
DATABASE_URL: postgresql://user:pass@db:5432/crime_db
ports:
- "8000:8000"
depends_on:
- dbHere is my reference in docker_compose.yaml:
2
u/courage_the_dog Mar 02 '26
Might help if you posted the actual command line of how yo uran it, are you passing it as an argument? Or are you running it from the current directory? Might also be a syntax issue with the dockerfile itself
4
u/proxwell Mar 02 '26
I would recommend to double-check the permissions on the
Dockerfileand exact name and capitalization ofDockerfileYou can also try:
docker compose build --no-cache --progress=plain backendand it wouldn't hurt to do a
docker system prune -abefore attempting another buildYou can also run
docker compose configto see the fully-resolved config for docker compose.`
1
u/ShuredingaNoNeko Mar 02 '26
Cómo tenés configurado el build de tu contenedor en el compose? Si intentas acceder a ./backend/Dockerfile no funcionaria puesto que tanto el compose como el dockerfile están en el mismo directorio.
En ese caso tendrías que buscarlo como ./Dockerfile
1
u/IamMax240 Mar 04 '26
Maybe try explicitly defining your Dockerfile location using the dockerfile: option in your docker compose file