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?
A devcontainer.json file in your project tells VS Code how to access (or create) a development container with a well-defined tool and runtime stack. This container can be used to run an application or to sandbox tools, libraries, or runtimes needed for working with a codebase.
To setup a Dev Container environment, you have two options: Manually write the files required. Get VS Code to take you through the configuration screen and create the boilerplate files for you. For your first attempt, I’d recommend option 2.
The VS Code extension API hides most of the implementation details of running remotely so many extensions will just work inside dev containers without any modification. However, we recommend that you test your extension in a dev container to be sure that all of its functionality works as expected.
The dev container configuration is either located under .devcontainer/devcontainer.json or stored as a .devcontainer.json file (note the dot-prefix) in the root of your project. You can use an image as a starting point for your devcontainer.json.
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:
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With