VSCode works great to debug node.js applications. But what if the application is running in a container? This in-depth tutorial explains how to set up Visual Studio Code (VSCode) on a mac (M1 or intel) in order to provide a complete integrated debugging experience of node.js containers that are launched with podman or docker via VSCode. Podman is a docker alternative, and so this video provides an in-depth analysis and tutorial on how to debug node.js containers using podman as well as docker. Furthermore, there is a detailed explanation of how the V8 javascript debugger works in node.js and how to use it for debugging your javascript apps.
Table of Contents:
00:00 - Introduction
00:35 - Objectives
02:09 - The VSCode F5 experience
04:45 - Overview of the execution environment
05:36 - Overview of the example code
06:13 - index.js: A self exiting script
06:24 - app.js: A long-running script
06:41 - Examples: Github repo URL
07:01 - The V8 JavaScript debugger
08:50 - Show the debugging API being activated
11:28 - Debugger API endpoint status page
12:07 - Debugger clients
12:23 - ndb debugger client
12:50 - node inspect terminal debugger client
16:02 - Visual Studio Code debugger client
17:15 - Node 'inspector' is an overloaded term
17:42 - Activating the inspector after startup
18:11 - The built-in node inspector module
19:48 - More on the node inspect command
23:07 - The kill SIGUSR1 pid option
25:13 - Javascript debugger quick recap
25:31 - Visual overview of the V8 debugger
28:05 - Visual of the debugger in a container
30:00 - Running the code in a docker container
31:35 - Binding code location to a local folder
34:47 - Terminal debugging in a docker container
37:00 - Pausing execution in a docker container
38:05 - Publishing the debugging ports to local
39:13 - Debugging with the Devtools client
42:07 - Debugging with the node client
45:58 - VSCode client: Docker debugging strategy
46:25 - VSCode client: Podman debugging strategy
47:45 - Manual setup of podman debugging session
47:57 - A passwordless ssh session
52:59 - Verify that podman is installed
53:37 - More about podman
54:00 - Running a container with podman
54:46 - Verify passwordless access to podman
55:45 - Example: Launch a container with podman
57:08 - Mounting folders in my dev environment
57:57 - About sshfs
59:20 - Unmounting sshfs mounted folders
01:00:33 - Ssh port forwarding from a remote host
01:02:03 - A port forwarding example with podman
01:04:54 - Verify ports are available in my dev env
01:06:00 - Next: Automating the manual steps
01:07:55 - Bash: Defining the needed variables
01:08:46 - Bash: Multiple commands in an ssh session
01:09:02 - Bash: Using a heredoc for multiple commands
01:10:59 - Bash: Summary of implementation
01:13:11 - Note: Importance of the working dir
01:14:56 - Bash: Testing the implementation
01:18:28 - LabNote: Teardown of a debug ssh session
01:19:34 - VSCode: Automate bash script invocation
01:19:44 - VSCode: Launch Configurations and Tasks
01:21:02 - VSCode: Create a launch configuration
01:23:33 - Launch Configuration: launch vs attach
01:24:27 - Launch Configuration: attachSimplePort
01:24:49 - Launch Configuration: localRoot
01:25:39 - Launch Configuration: remoteRoot
01:27:02 - Launch Configuration: A manual test
01:28:46 - Launch Configuration: stopOnEntry
01:30:56 - Launch Configuration: preLaunchTask
01:31:20 - VSCode: Creating tasks
01:32:53 - Task: openRemoteDebugSession
01:32:59 - Task Configuration: type = shell
01:34:21 - Task Configuration: presentation
01:36:02 - Task Configuration: isBackground
01:38:20 - Task Configuration: problemMatcher
01:39:16 - LabNote: self exit vs long-running scenario
01:40:07 - Task: closeRemoteDebugSession
01:40:53 - Task Configuration: handling error codes
01:41:36 - Launch Configuration: postDebugTask
01:42:12 - Task Configuration: minimal problemMatcher
01:42:42 - Task: openRemoteDebugSessionAndStopOnEnt
01:44:07 - VSCode: Testing and Verification
01:44:26 - LabNote : problemMatcher problems
01:45:41 - Launch Configuration: Add break on entry
01:46:49 - LabNote: Troubleshoot using presentation
01:50:56 - VSCode: Final testing and verification
01:57:21 - Conclusions Comments and Summary
02:01:15 - The End and The Future
![](https://i.ytimg.com/vi/ct0E50ooDuo/maxresdefault.jpg)