Docker Compose runs application, but cannot debug

Answered

I am able to run an application through PyCharm's Docker Compose run configuration, but I am unable to debug the app.

See the tutorial:

https://www.jetbrains.com/help/pycharm/using-docker-compose-as-a-remote-interpreter.html#debug

I have a project that has several containers, each running its own service. I followed the tutorial, but I set environment variables in the Run configuration. Additionally, the `docker-compose.yml` file starts a container each for `db`, `redis`, and `nginx` (as a proxy web server), and several other services that talk to one another, say `s1`, `s2`, etc. I can get the project to start all the services and run it just fine through PyCharm.

I created a Pyramid run configuration and tried to start it, but the debug says that the service is already running and exits.

I also tried creating a `docker-compose-dev.yml` file that would start all the necessary services in the proper order, but the debugger would still exit.

  1. Will the debugger honor environment variables?
  2. Do I need to stop the application first, then run the debugger to bring up all the necessary services?
  3. Pyramid uses an entry point, for example, `pserve development.ini --reload` to start the service/container in question. Does this prevent the debugger from working as expected?

I've scoured the PyCharm issue tracker, Stack Overflow, and this community without any luck.

7 comments
Comment actions Permalink

I have the same problem.

 

0
Comment actions Permalink

Hi Maximdunavicher, could you please create a ticket in our bug tracker and attach idea.log from Help | Show Log in ...? Also please specify docker and docker-compose versions you are using.

0
Comment actions Permalink

Sure, I will do today after work, meanwhile, I have created a stack overflow ticket that describes the full issue with screenshots of the configuration, and the project itself:
https://stackoverflow.com/questions/51575598/how-to-make-docker-compose-run-all-services-when-debuging-with-pycharm

0
Comment actions Permalink

Forget about it, problem solved.
Basically my docker-compose.yml file defined 3 services - db, Django gunicorn and nginx, when I made Django depend on the db and nginx, pycharm ran them both.

0
Comment actions Permalink

@Maximdunavicher are you able to debug and set break points? I am able to run the services, but not debug them, so it sounds like your issue is totally different from mine.

1
Comment actions Permalink

same problem, is thereany updates?

0
Comment actions Permalink

Hello, 

 

Please take a look at the following ticket https://youtrack.jetbrains.com/issue/PY-22815  and vote for it in order to increase its priority. If it does not correspond the problem you face, please feel free to submit a new ticket. 

 

Thank you! 

1

Please sign in to leave a comment.