5

I'm using docker-compose to build my docker container and am running the container with the --service-ports flag like so:

docker-compose run --service-ports $(service_name) -d

When trying to call ipdb within a python script in the container using import ipdb; ipdb.set_trace() ipdb is initialised but I cannot type anything in the console. I also have to manually restart the terminal session in order to stop it (CTRL+C, CTRL+D etc do nothing). It's not as if the terminal has frozen either as I can still scroll back and on focus / unfocus the cursor changes appearance too.

This is what my term looks like (I use iTerm): enter image description here

Any ideas how to fix this?

steve
  • 537
  • 1
  • 7
  • 17

2 Answers2

2

Turns out it boils down to ipdb not being compatible with eventlet.monkey_patch in the docker container.

Simple fix, switch to pdbpp :D

steve
  • 537
  • 1
  • 7
  • 17
  • Unfortunately `pdbpp` is still not properly compatible with Python 3.x, so this workaround doesn't work in all cases. – Kevin Mar 29 '17 at 09:34
  • Ahh, here's me still working in the ancient land of Python 2.7. At least now we understand it is simply a case-by-case compatibility issue we can explore other options. – steve May 24 '17 at 20:18
  • @kevin just for reference: pdbpp is being maintained again since a while, and compatible with py3: https://github.com/antocuni/pdb – blueyed Apr 09 '19 at 17:07
1

Following link worked for me for ipdb too:

https://blog.lucasferreira.org/howto/2017/06/03/running-pdb-with-docker-and-gunicorn.html

Snehal Parmar
  • 5,453
  • 3
  • 35
  • 46