Skip to content

Debbuging in Docker

cybersecuritylearning edited this page Nov 4, 2023 · 11 revisions

Setup to make VSCode able to debug directly from docker

First step

On the docker-compose file, we have to set, on the python server cyberpython, the number of workers to be 1 (--workers) in the gunicorn command. We have to expose a port from the same image, like 9001:9001.

Step two

We have to add some code on the /src/server/wsgi.py file.

import debugpy

debugpy.listen(('0.0.0.0', 9001))
debugpy.wait_for_client()
print("connected")
Clone this wiki locally