Need help with docker compose quickstart

Getting the following error in the first step of the Docker compose quick start guide. I know nothing about Docker compose so would appreciate some help:

➜ composetest docker compose up
[+] Running 1/0
:heavy_check_mark: Network composetest_default Created 0.0s
⠋ Container composetest-web-1 Created 0.0s
Attaching to web-1
web-1 | Usage: flask run [OPTIONS]
web-1 | Try ‘flask run --help’ for help.
web-1 |
web-1 | Error: Failed to find Flask application or factory in module ‘app’. Use ‘app:name’ to specify one.
web-1 exited with code 2

Folder structure and code is as follows. Very basic:

Any and all help is much appreciated. Again very new to this so if something obvious I apologize.

Neither the Dockerfile has an instruction to COPY your flask application into the image, nor does the compose file map the host folder containing the code into the container path /code.

So, how is the container supposed to access the flask app? You just copied the requirement and installed all dependencies, but never copied your application into the image.

I have no idea, again I am a newbie at Docker compose and following the quick start guide (minus redis) as it instructs here:

If you would kindly explain where the code is wrong what needs to be added and the why to it that would be much appreciated. Thank you in advance.

But I was also assuming the COPY . . in the Dockerfile is what was copying stuff over. But again newbie and have no idea.

Please ignore my last post.
I didn’t notice line 10, which indeed copies the content of the build context into the image.

I have no idea of flask and what needs to be done to make it work.

Which quick start guide? Can you share a link to it?

@rimelek Here is the link:

Any and all help is appreciated. Thank you.

I tried it now. It works perfectly. Check the instructions again and make sure you create all files correctly. For example the instruction shows two dependencies in the requirements.txt, you have one. The flask sourcecode is also different. Try the exact same files. If that works, then when you change it, it requires Python programming skills to make sure the source code is right. If the original code doesn’t work, we can try to find out what can affect it on your host to be different than on my host.

Yes I only have one because I was only trying to get the flask portion to work when i posted this question, no need having redis in the requirement.txt if I am not using it at all.

The point is that I can’t tell you by looking at the source code why it doesn’t work and the original code works. I didn’t have time for more testing and rewriting and I could not copy paste from the screenshot. I still recommend trying the original example. I didn’t need redis either, but I still tried :slight_smile:

Hi!
This error happened to me when i run docker compose up for the first time and my lines of code has some error.
Try docker compose build and then docker compose up, the docker compose up make a build first and then he made the up, but only once in the time.
I hope it helps!