I am running a debugpy listener inside a Docker container. I am using docker compose to run the containers. This is my config import debugpy debugpy.listen(("0.0.0.0", 5680)) _logger.info("Starting debug server at port 5680") debugpy.wait_for_client() # Execution will pause here until PyCharm connects _logger.info("Debugger attached. Resuming execution.") and my docker-compose.yml kafka-integration: image: web:${TAG:-dev} build: context: ../../../ dockerfile: deployments/web.dockerfile command: [ "python", "-m", "myproject.kafka.upload_channel_consumer" ] depends_on: kafka: condition: service_healthy env_file: - ./env/dev.env ports: - "5680:5680" I am using PyCharm community edition. How am I suppose to attach PyCharm to the debugpy listener inside the container? I think I can only use Run > Attach to Process... . I have tried: Checking for the PID inside the container and connecting to it. This produces: error: attach failed: tried to attach to process as user 'x' and process is running as user 'root' Searching for "docker compose" in the list under "Attach to process..." and connect to them. I get error: attach failed: attach failed (Not allowed to attach to process. Look in the console messages (Console.app), near the debugserver entries, when the attach failed. The subsystem that denied the attach permission will likely have logged an informative message about why it was denied.) How am I suppose to attach to debugpy inside the container? Continue reading...