我看了很多类似的问题,但我找不到适合自己的答案。我也去看了文档。这里 和 此处.
我在Windows上运行Ubuntu容器,我读到了关于 网络的局限性.
我用-p 3000:3000运行了这个容器。
错误=>连接ETIMEDOUT。
这是我的启动.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"
}
}
]
}