Debug python code in Docker container

I have a Docker image containing python code. The image itself is provided by another team and I won’t be able to modify the image. Now, I want to run through that python code in PyCharm's debugger. Is it possible to do that? If so, can you please explain the things I need to do?

Thanks!

2 comments

Please see https://stackoverflow.com/questions/29635319/debug-django-app-running-inside-docker-image-using-pycharm-debugger

Not sure you'll be able to achieve that if you're not allowed to modify the image.

You might want to copy the code locally and debug it that way.

0

PyCharm will fail to debug any Docker container that has more then just one python file.

Simple repo: add one line to python main.py file.

import anotherFile

PyCharm will throw "remote file can't be found" with three non-working options. 

Both PyCharm 2018 and 2019.

0

Please sign in to leave a comment.