cannot run python flask app in docker with vscode (from tutorial)

  docker, flask, python-3.x, visual-studio-code

I build a sample flask app by this tutorial
Afterwards I tried to build a docker out of it and followed the steps in this tutorial

The app runs in debug mode in localhost.
The docker is build without any error.
When I try to run the docker in debug mode, there pops up an error and I do not know why

 * Serving Flask app ""
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
Usage: python -m flask run [OPTIONS]
Try 'python -m flask run --help' for help.

Error: Could not import "hello_app__init__".

I tried "hello_app__init__:app" as well as "hello_app__webapp__:app" as entrypoint in the dockerfile – always the same issue.

here my project structure:

enter image description here


from flask import Flask
app = Flask(__name__) # Flask instance named app

# Entry point for the application.
from . import app    # For application discovery by the 'flask' command.
from . import views  # For import side-effects of setting up routes.


{"version": "0.2.0", "configurations": [{"name": "Python: Flask", "type": "python", "request": "launch", "module": "flask", "env": {"FLASK_APP": "hello_app/webapp", "FLASK_ENV": "development"}, "args": ["run", "--no-debugger"], "jinja": true}, {"name": "Docker: Python - Flask", "type": "docker", "request": "launch", "preLaunchTask": "docker-run: debug", "python": {"pathMappings": [{"localRoot": "${workspaceFolder}", "remoteRoot": "/app"}], "projectType": "flask"}}]}


# For more information, please refer to
FROM python:3.8-slim-buster


# Keeps Python from generating .pyc files in the container

# Turns off buffering for easier container logging

# Install pip requirements
COPY requirements.txt .
RUN python -m pip install -r requirements.txt

COPY . /app

# Creates a non-root user with an explicit UID and adds permission to access the /app folder
# For more info, please refer to
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
USER appuser

# During debugging, this entry point will be overridden. For more information, please refer to
CMD ["gunicorn", "--bind", "", "hello_app__init__:app"]

Source: Docker Questions