python-flask-docker-compose-debugging
python-flask-docker-compose-debugging copied to clipboard
:bug: Sample application to help illustrate how to break into the debugger in a Python Flask application running as a container in Docker Compose
Debugging a Python Flask app in Docker Compose
This is the companion repository to this blog post (Medium)
Running the application
$ docker-compose run --build -d
Debugging the application
If changes were made to the file (e.g. added breakpoint), build first...
$ docker-compose build
Run the application in Docker Compose but specify a particular command...
$ docker-compose run -p 8000:8000 svc1 python3 -m pdb app.py
Debug the application as you would any other Python application
Interacting with the application
Display simple message
$ curl localhost:8000
Add message to application (Redis cache)
$ curl -X POST localhost:8000/message/<message_to_add>
Get message from application (stored in Redis)
$ curl -X POST localhost:8000/message