PTVS icon indicating copy to clipboard operation
PTVS copied to clipboard

VSC debugger crashes when trying to attach to process running in docker container

Open b99andla opened this issue 8 years ago • 1 comments

Im trying to debug my Django process from vs code. But I am not able to get it to work. In my manage.py:

import ptvsd
try:
    ptvsd.enable_attach("my_secret", address=('localhost', 3000))
except:
    pass

In my docker-compose:

version: '3'

services:
  db:
    image: postgres
  web:
    build: .
    command: python3 manage.py runserver 0.0.0.0:8000
    volumes:
      - .:/code
    ports:
      - "8000:8000"
      - "3000:3000"
    depends_on:
      - db

And my debug info in launch.json:

{
  "name": "Attach (Remote Debug)",
  "type": "python",
  "request": "attach",
  "localRoot": "${workspaceFolder}",
  "remoteRoot": "/code",
  "port": 3000,
  "secret": "my_secret",
  "host": "localhost"
},

When starting the debug session I get a message saying: "debug adapter process has terminated unexpectedly". Does anyone have any tips on how to get this working? Im running ptvsd 3.0.0 both on my computer and in the docker container.

b99andla avatar Feb 05 '18 19:02 b99andla

This sounds VSC specific. Please file it at https://github.com/Microsoft/vscode-python/issues. Thanks!

huguesv avatar Feb 05 '18 19:02 huguesv