Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

913
Vistas
PyCharm remote debug in a docker container

I'm having an hard time trying to figure out how to setup a remote debug of a python app (Flask) running in a Docker container. Specifically I'm using docker-compose, PyCharm professional and python 3.5. This is what I've done so far:

  • I copied "pycharm-debug-py3k.egg" into the project folder
  • I added the following lines in the wsgi.py file:

    import sys
    sys.path.append('../pycharm-debug-py3k.egg') 
    import pydevd 
    pydevd.settrace('0.0.0.0', port=8200, stdoutToServer=True, stderrToServer=True)
    
  • I created a remote debug configuration in PyCharm (by mapping the path of my local machine project path to the one in the docker container)

by running the debug configuration (click on the bug icon) from PyCharm it prints (and hangs):

Starting debug server at port 4200
Use the following code to connect to the debugger:
import pydevd
pydevd.settrace('0.0.0.0', port=4200, stdoutToServer=True, stderrToServer=True)
Waiting for process connection...

...and in the docker container logs I read:

Could not connect to 0.0.0.0: 4200

What should I do? (My goal is to be able to add breakpoints in PyCharm and stop the execution of the docker container app in order to debug it)

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

Use a remote interpreter, this will solve a couple of issues at once. I already answered this here Rich editors in a Docker development environment

Add a remote python SDK to your IDE, this will then also resolve all the libraries being installed remotely. You will require an SSH connection to get this done though, so install sshd and use the shared developer key I outlined in my answer.

Even though this now a bit more effort, I will give you a lot better results, also in the other sections you did not yet encounter and will find, when doing just a remote-port connection.

If you still want to use the port-based debugging, see Docker: MacOSX Expose Container ports to host machine - this explains how you should understand the attach and the listen part.

over 4 years ago · Santiago Trujillo Denunciar

0

Use host.docker.internal instead of 0.0.0.0. This will allow docker to decide which IP to use.

over 4 years ago · Santiago Trujillo Denunciar

0

Maybe you should connect to you self host machine that is you pycharm in. not 0.0.0.0 instead of you self ip address

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda