I've setup a Python Flask project to point at an interpreter running in Docker:
Starting the Flask app from PyCharm IDE results in following output:
51be5e336622:python3 -u /opt/project/app.py
Starting server
* Serving Flask app "app" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)
* Restarting with stat
Starting server
* Debugger is active!
* Debugger PIN: 328-461-278
Trying to open http://localhost:5000/ results in a page not found error.
If I run the app using Docker with Dockerfile:
FROM python:3.8-slim-buster
WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
COPY . .
EXPOSE 5000
#CMD [ "python3", "-m" , "flask", "run", "--host=0.0.0.0"]
CMD [ "python3", "-u" , "/app/app.py"]
The above Dockerfile builds the container PyCharm connects to and is configured within Pycharm as:
Running the Docker container using command docker run -p 5000:5000 services, the app is started on http://localhost:5000/ successfully.
Do I need to map the port 5000 from PyCharm IDE to the Docker container running on port 5000? How to achieve this, there does not seem to be an option within PyCharm IDE?

