Debugging with docker-compose
Hi,
I am just a little bit confused with debugging while having docker-compose as a remote interpreter.
In my docker-compose.yml are three containers: one python-app (which I want to debug) and two containers creating a kafka-envrionment the app connects too.
I have the remote-interpreter set to the docker-compose-file and create a run/debug-configuration using this interpreter. Now, if I understand correctly, only the service which I selected in the configuration of the docker-compose file is started?
Basically my questions is: is it not possible to start all services in a docker-compose-file and debug a specific container?
(if so, I will cancel my membership- this would be a total blocker for my development)
Please sign in to leave a comment.
Hi,
Do you link the services in your docker-compose.yml file?
The linked services should start automatically and you should be able to debug your Python code. See our docs for example https://www.jetbrains.com/help/pycharm/using-docker-compose-as-a-remote-interpreter.html
Hi Sergey,
thanks for your reply. You're right, the link is missing. I read the linked article before- I didn't know the link is necessary. I debugged before in VSC without links and it worked fine. Maybe it should be highlighted to be mandatory.
Now I have additional issues:
- breakpoints are not hit, even if the debugger says its connected
- stopping only stops the debugged container - is there a possibility to configure it a way, that all containers are stopped?
>stopping only stops the debugged container - is there a possibility to configure it a way, that all containers are stopped?
PyCharm adds --abort-on-container-exit option by default which should make other containers stop when one of them is stopped. If it doesn't happen, then it looks like a docker-compose issue.
>breakpoints are not hit, even if the debugger says its connected
Could you file an issue to https://youtrack.jetbrains.com/issues/PY and provide steps for reproducing the problem?
We'll investigate.