11

I created a new Dev Container in VS Code, and VS Code added .devcontainer folder to my workspace. Should I check this file in to git?

Matt Bierner
  • 58,117
  • 21
  • 175
  • 206

1 Answers1

15

Yes, we recommend that you check in the .devcontainer folder (or .devcontainer.json file) as they define the environment and tools used to develop your project.

Checking in a dev container definition to your repo makes it easier for new contributors to get started with your project and can ensure that all developers are using a consistent set of development tools and a consistent environment (for example, the same version of yarn, the same python runtime, etc...)

When a developer clones a repository with a dev container definition and opens that project in VS Code, they will be asked if they want to re-open the project in a dev container:

The Re-open in container command

Once the container builds, VS Code will start up inside an isolated environment that already has all the tools needed to start contributing. Since the environment is isolated from the local machine so developers don't have to worry about messing up their local environment when testing out your project

Matt Bierner
  • 58,117
  • 21
  • 175
  • 206
  • 1
    My dev container definition contains mounts, these are pointing to folders in my file system. What do you recommend in this case? They mounts contain data stored on a network drive... – Thomas Apr 20 '21 at 13:49