Skip to content
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 #168244

Closed
akumareog opened this issue Dec 6, 2022 · 1 comment
Closed

Debugging Docker Container -- Not properly attaching to container #168244

akumareog opened this issue Dec 6, 2022 · 1 comment
Assignees

Comments

@akumareog
Copy link

Type: Bug

Debugging with the launch.json and tasks.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 either node --inspect=0.0.0.0 app.js or node app.js.

My current debug setup:

launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Docker: Node Debug Service",
      "type": "docker",
      "request": "launch",
      "platform": "node",
      "preLaunchTask": "docker-run:debug service"
    }
  ]
}

tasks.json

{
  "version": "2.0.0",
  "tasks": [
    {
      "type": "docker-build",
      "label": "docker-build",
      "platform": "node",
      "dockerBuild": {
        "context": "${workspaceFolder}",
        "dockerfile": "${workspaceFolder}/Dockerfile",
        "customOptions": "--platform linux/amd64",
        "tag": "node-app",
        "pull": true
      }
    },
    {
      "type": "docker-run",
      "label": "docker-run:debug service",
      "dependsOn": ["docker-build"],
      "platform": "node",
      
      "dockerRun": {
        "remove": true,
        "env": {
          "foo": "bar"
        },
        "ports": [{ "containerPort": 8080, "hostPort": 8080 }],
        "containerName": "node-debug-service"
      },
      "node": {
        "enableDebugging": true
      }
    }
  ]
}

VS Code version: Code 1.73.1 (Universal) (6261075, 2022-11-09T02:08:38.961Z)
OS version: Darwin arm64 22.1.0
Modes:
Sandboxed: No

System Info
Item Value
CPUs Apple M1 Max (10 x 24)
GPU Status 2d_canvas: enabled
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
Load (avg) 3, 3, 4
Memory (System) 64.00GB (13.35GB free)
Process Argv --crash-reporter-id 6b794953-834c-45f8-8b9f-19b2e3c1868e
Screen Reader no
VM 0%
Extensions (42)
Extension Author (truncated) Version
better-comments aar 3.0.2
vscode-sql-formatter adp 1.4.4
vscode-sqlite ale 0.14.1
vscode-fish bma 1.0.31
npm-intellisense chr 1.4.3
vscode-markdownlint Dav 0.48.1
es7-react-js-snippets dsz 4.4.3
gitlens eam 13.1.1
vscode-html-css ecm 1.13.1
EditorConfig Edi 0.16.4
vscode-npm-script eg2 0.3.29
prettier-vscode esb 9.10.3
shell-format fox 7.2.2
go gol 0.36.0
cloudcode goo 1.20.5
hcl has 0.3.1
terraform has 2.25.1
file-downloader min 1.0.12
mindaro min 1.0.120221201
theme-monokai-pro-vscode mon 1.2.0
vscode-docker ms- 1.23.1
vscode-dotnet-runtime ms- 1.6.0
vscode-kubernetes-tools ms- 1.3.11
data-workspace-vscode ms- 0.3.0
mssql ms- 1.16.0
sql-bindings-vscode ms- 0.3.0
sql-database-projects-vscode ms- 0.19.0
isort ms- 2022.8.0
python ms- 2022.18.2
vscode-pylance ms- 2022.11.40
remote-containers ms- 0.262.3
indent-rainbow ode 8.3.1
oracledevtools Ora 21.5.0
material-icon-theme PKi 4.22.0
ruby reb 0.28.1
vscode-yaml red 1.10.1
fish-vscode sky 0.2.1
tabnine-vscode Tab 3.6.31
ayu tea 1.0.5
pdf tom 1.2.0
vscode-ruby win 0.28.0
plsql-language xyz 1.8.2
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492cf:30256860
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242cf:30382550
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
vscorecescf:30445987
pythondataviewer:30285071
vscod805cf:30301675
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593:30376534
pythonvs932:30410667
cppdebug:30492333
vscaat:30438848
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
azure-dev_surveyone:30548225
pyindex848cf:30577861
nodejswelcome1cf:30587006
282f8724:30602487
gswce1:30612156
3d0df643:30613357
dbltrim-noruby:30604474
f6dab269:30613381
fim-prod:30623723

@roblourens
Copy link
Member

Please file on the vscode-docker extension's repo, thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants