Visual Studio代码在将远程debugging附加到docker容器中的瓶颈应用程序期间卡住了

我目前正在从primefaces切换到Visual Studio代码 – 部分原因是debuggingfunction。

不幸的是我不能在以下设置中运行远程debugging

networking/ app.py

from flask import Flask app = Flask(__name__) import ptvsd try: ptvsd.enable_attach(secret=None, address = ('0.0.0.0', 3000)) ptvsd.wait_for_attach() ptvsd.break_into_debugger() except: pass @app.route('/') def hello_world(): return 'Flask Dockerized' if __name__ == '__main__': app.run(debug=False,host='0.0.0.0', port=5000) 

泊坞窗,compose.yml

 web: build: ./web ports: - "5000:5000" - "3000:3000" volumes: - .:/code 

launch.json

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

问题:当我运行docker-compose时,我得到:

 starting container flaskdocker ... starting container flaskdocker ... done attaching to flaskdocker 

它只是卡在那里,我不能访问端口上的烧瓶应用程序:5000(附加debugging之前完美工作)。

为什么? :/ 请帮忙!

我在使用Visual Studio Code 1.15.1的macOS上。

从Visual Studio Code使用ptvsd> 3.0.0进行远程debugging时报告了一些问题。

最经常提到的问题是VSC在试图连接到远程debugging器时“挂起”。

现在,使用ptvsd 3.0.0:
pip install ptvsd==3.0.0