Exercise 2: Write a devcontainer.json — Possible Solution ==================================================================== EXAMPLE: a small Node.js project STEPS ------------------------------ 1. In the project's root, create a folder named exactly ".devcontainer". 2. Inside it, create "devcontainer.json": { "name": "Node Dev Container", "image": "mcr.microsoft.com/devcontainers/javascript-node:20", "customizations": { "vscode": { "extensions": [ "dbaeumer.vscode-eslint", "esbenp.prettier-vscode" ] } }, "forwardPorts": [3000] } 3. Save the file. 4. If Docker is installed (per the site's own docker1 course) and the Dev Containers extension is installed (Exercise 1), open the Command Palette (Ctrl+Shift+P) and run "Dev Containers: Reopen in Container." 5. VS Code pulls the specified image, builds the container, and reopens the same project folder — but now running INSIDE that container. Opening the integrated terminal (Chapter 6) shows a Linux shell with Node.js pre-installed at the exact version from the image, and the ESLint/Prettier extensions (Chapter 4) already auto-installed inside the container itself. WHY THIS WORKS AS AN ANSWER ------------------------------ The image field reuses the chapter's own devcontainer.json structure exactly, just swapped from the chapter's Python example to a Node.js base image appropriate for this project — using an official Microsoft "devcontainers" image, the same pattern the chapter's own example used, rather than an arbitrary or unofficial one. Listing extensions under customizations.vscode.extensions reuses the chapter's own field path directly — this is what makes the recommended extensions install AUTOMATICALLY the first time the container builds, without a teammate needing to separately follow Chapter 5's extensions.json workflow after connecting. forwardPorts: [3000] is a reasonable, realistic addition beyond the chapter's own minimal example — a Node.js dev server commonly runs on port 3000, and Dev Containers needs to know which container ports to expose back to the local machine's browser for anything served from inside the container to actually be reachable.