This example tutorializes how to set up and run Microsoft's standard Node.js & JavaScript Dev Container Template (mcr.microsoft.com/devcontainers/javascript-node) on your own machine.
WSL Docker Visual Studio Code
- Access Visual Studio Code's Command Palette (Ctrl+Shift+P) or the top search bar and enter ">"
- Enter "Dev Containers: New Dev Containers..."
- Enter "Node.js & Javascript", you'll find a matching template by devcontainers (verified) from GitHub
- Uncomment "forwardPorts": [], add 3000 or your desired port(s) within the square brackets
- Enter "Dev Containers: Rebuild" into the Command Palette
- Add app.js to the root of the project with just a simple console.log("Hello, World!") statement
- Access "Run and Debug" through the icon on the left-hand sidebar and click "Run and Debug", OR enter "node app.js" in the project's bash terminal through View > Terminal in the top bar to test the application