Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't type in ipdb console in docker container

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?

like image 508
steve Avatar asked Oct 17 '22 21:10

steve


2 Answers

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

Simple fix, switch to pdbpp :D

like image 65
steve Avatar answered Oct 21 '22 00:10

steve


Following link worked for me for ipdb too:

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

like image 21
Snehal Parmar Avatar answered Oct 21 '22 00:10

Snehal Parmar