-
Notifications
You must be signed in to change notification settings - Fork 676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Instructions on remote debugging with Docker? #1369
Comments
@kikkoi we have a fix on the way, meanwhile please use this config as an example {
"name": ".NET Core Remote Attach",
"type": "coreclr",
"request": "attach",
"processId":12345,
"pipeTransport": {
"pipeProgram": "docker",
"pipeArgs": [ "exec", "-i", "90d6d355c37c"],
"debuggerPath": "~/vsdbg/vsdbg",
"pipeCwd": "${workspaceRoot}",
"quoteArgs": false
},
"sourceFileMap": {
"/Views": "${workspaceRoot}/Views"
}
} |
Followed the example. I'm having issue that error "The pipe program 'docker' exited unexpectedly with code 126" and doing nothing. http://imgur.com/a/MbJvt
What am I doing wrong? or it's bug? |
Any chance we can get some definitive examples on this? I came up with the following: {
"name": "Debug Api",
"type": "coreclr",
"request": "attach",
"sourceFileMap": {
"/app": "${workspaceRoot}/src/Api"
},
"processName": "dotnet",
"pipeTransport": {
"debuggerPath": "/vsdbg/vsdbg",
"pipeProgram": "powershell",
"pipeCwd": "${workspaceRoot}",
"pipeArgs": [
"-c",
"docker exec -i api_1"
]
}
}, Which works (there's definitely some oddities but I think that's vscode/vsdbg related). But as you can see I have to hard code the specific container I want. Is there a way we can interrogate the running containers and show a picker (just like the docker extension for vscode)? More than happy to do the leg work here but not sure where to start |
@chrisdias: Is there a generic 'docker container chooser` that the docker extension provides that @herecydev can use in his launch.json? CC @glennc @Andrew-MSFT |
@gregg-miskelly Is vsdbg (as I'm doing it) still the recommend way of debugging containers? |
@herecydev you will definitely need to run vsdbg. But I don't think there is any reason to use powershell any longer. Does this work? (NOTE: this requires the 1.9 version of the extension) {
"name": "Debug Api",
"type": "coreclr",
"request": "attach",
"sourceFileMap": {
"/app": "${workspaceRoot}/src/Api"
},
"processName": "dotnet",
"pipeTransport": {
"debuggerPath": "/vsdbg/vsdbg",
"pipeProgram": "docker",
"pipeCwd": "${workspaceRoot}",
"pipeArgs": [
"exec", "-i", "api_1"
],
"quoteArgs": false
}
}, |
Can't try until tomorrow but looks solid. There's 2 problems that need smoothing out
|
For 2: vsdbg needs the PDBs inside the container. But you would likely want to sync your enlistment to the code you are trying to debug (or point your sourceMap to some other copy of the code that is in-sync with what you are debugging). |
@gregg-miskelly no there is no generic 'docker container chooser' in the docker extension. Code is simple though, see here: https://github.com/Microsoft/vscode-docker/blob/master/commands/utils/quick-pick-container.ts#L40 |
@chrisdias Is this something you are looking to support in the extension itself? Feels like something that many people would benefit from. Not sure how to untie it from specifically .net though. |
I know that the issue was closed, but I thinks there's still something to say about remote debugging with omnisharp. There's no proper wiki page that will tell us how to setup vscode, omnisharp and our project to be able not only debug in Docker container, but also build the whole app in Docker container (that will allow us not to install every version of dotnet sdk on the host machine). So, I've created some sample repo where I set up all the pieces to be able to build and debug in Docker container. Hope this helps. https://github.com/sleemer/docker.dotnet.debug |
I know this is an old issue but as I landed on this page while setting my dotnet core app inside docker container so for anyone new looking for a solution. I have been doing vsdbg approach. But now I switched to using Remote - Containers extension of VS Code and reinstall OmniSharp once your VS Code is installed inside the container. It works really well for me. It needs a bit of set up to get started but this is the way forward developing dotnet core app with docker. for more information please see this link. https://code.visualstudio.com/docs/remote/containers |
Environment data
dotnet --info
output:.NET Command Line Tools (1.0.0)
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\1.0.0
VS Code version: 1.11.0
C# Extension version: 1.8.1
Steps to reproduce
Expected behavior
Start debug. Throw error "Starting: "C:\windows\system32\cmd.exe" /c docker.exe exec -i c3e211ef953f vsdbg --interpreter=vscode" in Debug console. Too I tried before writing docker exec in CMD and didn't work out so well.
I'd be thankful if you could instruction on this. Because can't find something in good instruction for remote debugging with Docker.
The text was updated successfully, but these errors were encountered: