Hey everyone! I used to build my application images quickly with Docker, but after I turned off my OneDrive backup, I started running into issues. While my existing containers work fine, whenever I try to build a new one or rebuild an old one, I get an error that says it can't find the Dockerfile. The relevant part of my directory structure looks like this: there's a 'backend' folder containing the Dockerfile, main.py, and requirements.txt, as well as the docker-compose.yml file. Here's the important part of my docker-compose.yml: the build references the './backend' directory. Does anyone have any ideas on how to fix this?
2 Answers
Could you let us know how you're actually running the command? Are you doing it from the right directory? Sometimes it might just be a syntax issue in the Dockerfile itself, or if you're specifying it correctly as an argument when running the command.
First off, make sure to check the permissions on your Dockerfile and ensure that the capitalization is correct since it matters on some systems. You might also try running this command: `docker compose build --no-cache --progress=plain backend`. Before running the build again, do a `docker system prune -a` to clear out unused images. Lastly, running `docker compose config` can help you see the full configuration—might reveal something off there!

Thanks for the suggestions! Here's the command I'm using: `docker compose build`. I did get a warning about the `version` attribute being obsolete in my docker-compose.yml, and I noticed some errors related to the loading of the Dockerfile. Could that be related?