

To install and use the command line interface as well as run the Angular application server, you'll need the Node.js JavaScript runtime and npm (the Node.js package manager) installed. We'll be using the Angular CLI for this tutorial. Note: To help get you started with Angular development, you can use the Angular profile template that includes useful extensions, settings, and code snippets. The Visual Studio Code editor supports TypeScript IntelliSense and code navigation out of the box, so you can do Angular development without installing any other extension. Angular uses TypeScript as its main programming language. Configure IntelliSense for cross-compilingĪngular is a popular web development platform developed and maintained by Google.You're done! Now that your container is ready, you may want to: The output will be displayed in the terminal. In the Containers tab, right-click on your container and choose View Logs. You can view the logs in VS Code by using the View Logs command on the container: You can configure the application to wait for the debugger to attach before starting execution by setting the inspectMode property to break in the docker-run: debug task in tasks.json under the node object.

Note that, because the debugger attaches after the application starts, the breakpoint may be missed the first time around you might have to refresh the browser to see the debugger break on the second try. The debugger stops at the breakpoint in index.js.The browser opens to the (random) port mapped to the service container.The Docker container for the service runs.The Docker image for the service builds.Make sure the Docker Node.js Launch debugger configuration is selected. Set a breakpoint in the get() handler for the '/' route in routes/index.js. The extension detects the protocol and port used by the service and points the browser to the service. vscode/launch.json for debugging the service when running inside a container. When the Docker extension adds files to the application, it also adds a VS Code debugger configuration in. When done testing, right-click the container in the Containers tree and select Stop. The container should start and you should be able to see it in the Docker Containers tree: Right-click on the image built in the previous section and select Run or Run Interactive. Open the Docker Explorer and verify that the new image is visible in the Images tree: Open the Command Palette ( ⇧⌘P (Windows, Linux Ctrl+Shift+P)) and select the Docker Images: Build Image. When done testing, type Ctrl+C in the terminal. Open the web browser and navigate to You should see a page similar to the following: Open a terminal ( ⌃` (Windows, Linux Ctrl+`)).Įnter npm run start to start the application: > start /Users/user/code/scratch/express-app Put the environment variable definition in the base stage to have this variable available in both debug and release versions of the container image. The Docker extension uses the base stage of the Dockerfile to create a debug version of the container image for your service. Note how the Docker extension lists all available Dockerfile instructions and describes the syntax. Use ENV instruction to add an environment variable to the service container image. To see this feature in action, add an environment variable to your service image by following these steps: The Docker extension helps you author Dockerfiles by using IntelliSense to provide auto-completions and contextual help. vscode/launch.json for debugging the service within the container. vscode/tasks.json for building and running the container (in both debug- and release-configurations) and a launch debug configuration in. Finally, the extension will create a set of VS Code tasks in. If you elected to include Docker Compose files, docker-compose.yml and will be generated as well. Compose is typically used when running multiple containers at once. Select either Yes or No when prompted to include Docker Compose files.

Select Node.js when prompted for the application platform.Įnter 3000 when prompted for the application port. Open the Command Palette ( ⇧⌘P (Windows, Linux Ctrl+Shift+P)) and use Docker: Add Docker Files to Workspace. Open a development command prompt in the project folder and create the project: npx express-generator npm install Both Docker and the VS Code Docker extension must be installed as described in the overview.Debug the service running within a container.Build, run, and verify the functionality of the service.

