-
Notifications
You must be signed in to change notification settings - Fork 521
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
Debugging Docker Container -- Not properly attaching to container #3751
Comments
Can you share the output from the tasks terminal window for the |
Sure. I removed some sensitive information but if needed I can format and include here as well. EDIT: Removed links to other issues....
|
@philliphoff were there any issues with debugging Node on M1's, back when you were looking into it? Especially cross-platform (if that's the right term) with amd64 containers. |
Just to add: I tried debugging a similar set up I have but for a Python app and I'm seeing similar issues. Both of these debuggers worked alright within the past month even with the warning about mismatched platforms. In both cases, after the
{
"version": "0.2.0",
"configurations": [
{
"name": "Docker: Python App Debug",
"type": "docker",
"request": "launch",
"preLaunchTask": "docker-run: debug",
"python": {
"pathMappings": [
{
"localRoot": "${workspaceFolder}/src",
"remoteRoot": "/opt/app/src"
}
],
"projectType": "general"
}
}
]
}
{
"version": "2.0.0",
"tasks": [
{
"label": "docker-build",
"type": "docker-build",
"dockerBuild": {
"context": "${workspaceFolder}",
"dockerfile": "${workspaceFolder}/Dockerfile",
"tag": "enterprise-registry.com/python-app:latest",
"pull": true,
"customOptions": "--platform linux/amd64"
}
},
{
"type": "docker-run",
"label": "docker-run: debug",
"dependsOn": ["docker-build"],
"dockerRun": {
"containerName": "python-app-debug",
"image": "enterprise-registry.com/python-app:latest",
"env": {
"foo": "bar"
}
},
"python": {
"file": "app.py"
}
}
]
}
Build and run terminal outputs:
|
Can you try rolling back the Docker extension to 1.22.2, to see if that fixes it? That would help narrow down a potential cause. You can do so by running the command "Extensions: Install Specific Version of Extension..." in the command palette. |
(Sorta thinking out loud here) I wonder if the change to the bind mount syntax is causing this. I think that's the most substantial change to debugging--before, we used EDIT: well, Node doesn't even use mounts, so I don't think it's that... |
Could be something to do with the docker run command. The latest version of the Docker extension uses what I'm guessing is the latest syntax for spinning up the container. Here's what was executed for the Node app with v1.22.2 of the Docker extension that was successful:
EDIT: Only real difference I see is the |
In theory that is supposed to be identical to the |
I tried running one container each with the old and new command, and then inspecting them, but they are identical in every way (except for the ways you'd expect, like container ID and similar). I have another theory though. We've made some considerable changes to how processes are run in the background, including potentially some different handling for output to stderr. I was able to reproduce something that looked more or less the same symptoms by running a I need to keep digging into this, but I suspect that warning is being emitted to stderr, which might be causing the extension to erroneously think the |
This could be the same issue causing #3750. |
I think I found the root cause underneath everything. In short, we had two bugs in 1.22.2 (and many versions prior)--but they cancelled each other out. In 1.23.0, we fixed one of those bugs, which caused the other one to show up. Throughout older versions and 1.23.0+, we had a flag to reject if anything was emitted to stderr from
The way this rejection occurred was to throw on stderr here: vscode-docker/src/tasks/DockerPseudoterminal.ts Lines 76 to 82 in 959987e
But that doesn't throw out of that vscode-docker/src/utils/spawnAsync.ts Lines 98 to 110 in 959987e
So the fix is two-fold.
|
I know the .NET debugger doesn't like operating cross-architecture (e.g. using |
A fix for this has been released in 1.23.3. |
Type: Bug
References issue in vscode repo here
Debugging with the
launch.json
andtasks.json
set up as prescribed by the docs here was working up until recently. It seems it's able to spin up the container. But afterwards it's not able to attach properly and output container logs to the Debug Console, nor is it able to respect the breakpoints I insert in VS Code.Not sure it's relevant here, but the docker image has an
entrypoint.sh
where depending on the"foo"
environment variable will execute eithernode --inspect=0.0.0.0 app.js
ornode app.js
.My current debug setup:
launch.json
tasks.json
VS Code version: Code 1.73.1 (Universal) (6261075646f055b99068d3688932416f2346dd3b, 2022-11-09T02:08:38.961Z)
OS version: Darwin arm64 22.1.0
Modes:
Sandboxed: No
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: disabled_off
Extensions (42)
A/B Experiments
The text was updated successfully, but these errors were encountered: