我读了很多类似的问题,但我找不到任何答案。我还浏览了文档:here和here。
我在Windows上运行了一个Ubuntu容器,我读到了关于limitation in Networking的文章。
我使用-p 3000运行容器:3000
错误=> connect ETIMEDOUT
这是我的launch.json
"configurations": [
{
"name": "Python: Remote Attach",
"type": "python",
"request": "attach",
"port": 3000,
"host": "172.17.0.2",
"pathMappings": [
{
"localRoot": "${workspaceFolder}/somefolder/somefolder",
"remoteRoot": "/rootfolder/"
}
]
},这是我的tasks.json:
{
"version": "2.0.0",
"tasks": [
{
"type": "docker-build",
"label": "docker-build",
"platform": "python",
"dockerBuild": {
"tag": "test:latest",
"dockerfile": "${workspaceFolder}/somefolder/somefolder",
"context": "${workspaceFolder}",
"pull": true
}
},
{
"type": "docker-run",
"label": "docker-run: debug",
"dependsOn": ["docker-build"],
"python": {
"module": "C:\\...\\somefolder"
}
}
]
}发布于 2020-05-08 04:30:16
您可以尝试使用remote extensions,因为它应该透明地处理所有这些操作。
This是Visual Studio代码在容器中进行远程调试的扩展。您可以将python脚本附加到正在运行的容器,它将导入所有需要的依赖项。
https://stackoverflow.com/questions/61529906
复制相似问题