Search code examples
gitdockervisual-studio-codevscode-remote

Should I check in the VS Code dev container files? For example, the .devcontainer folder or .devcontainer.json file?


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?


Solution

  • 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