Introducing Visual Studio Code Remote-Containers
The Remote-Containers extension for Visual Studio Code sits as part of the Remote-Development extension pack alongside Remote-WSL and Remote-SSH. All of these extensions allow you to separate the user interface aspects from the code interactions, such as loading, running, and debugging your code. With Remote-Containers, we instruct Visual Studio Code to run these code interactions inside a container that we define in a Dockerfile (see Chapter 7, Working with Containers in WSL, the Introducing Dockerfiles section).
When Visual Studio Code loads our project in a dev container, it goes through the following steps:
- Builds the container image from the Dockerfile
- Runs a container using the resulting image, mounting the source code in the container
- Installs the VS code server in the container for the user interface to connect to
Through these steps, we get a container image that contains the dependencies described...