I have a Python app (Flask, but this is likely incidental) which I have Docker-ized (using Docker Compose, which is again likely incidental). I have processes other than python
/flask
which need to run in the same container, and I user supervisord
for this as it is convenient.
I set a pdb
breakpoint pdb.set_trace()
in my code and want to connect to my Flask app's TTY so I can interact with the (pdb)
prompt. This usually works fine, but I'm not usually using supervisord
. I can't get a reliable interactive (pdb)
prompt - it looks like my terminal is not connected properly.
The usual steps to allow debugging (via docker attach
) have failed me:
Telling docker-compose.yml
to open the tty and connect stdin:
stdin_open: true
tty: true
Telling docker-compose.yml
to set PYTHONUNBUFFERED
:
PYTHONUNBUFFERED: 'true'
My supervisord
block for the process is:
[supervisord]
nodaemon=true
[program:flask]
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
command=flask run
How can I work with pdb
running under Docker and supervisord
?