Visual Studio Code Remote Development Open any folder in a container, on a remote machine, or in WSL and take advantage of VS Code's full feature set. Learn more! |
A development container is a running Docker container with a well-defined tool/runtime stack and its prerequisites. The Remote - Containers extension in the Remote Development extension pack allows you to open any folder mounted into or inside a dev container and take advantage of VS Code's full development feature set.
This repository contains a set of dev container definitions to help get you up and running with a containerized environment. The definitions describe the appropriate container image, runtime arguments for starting the container, and VS Code extensions that should be installed. Each provides a container configuration file (devcontainer.json
) and other needed files that you can drop into any existing folder as a starting point for containerizing your project. (The vscode-remote-try-* repositories may also be of interest if you are looking for complete sample projects.)
To add a dev container definition in your project, you can either:
-
Add it using VS Code:
- If this is your first time creating a dev container, follow the getting started steps to configure your machine.
- Start VS Code and open your project folder.
- Press F1 and select either the Remote-Containers: Add Development Container Configuration Files... or Remote-Containers: Reopen Folder in Container commands.
- Follow the directions and pick one of the existing development container definitions in this repository from the list. You may need to choose the From a predefined container configuration definition... option if your project has an existing Dockerfile or Docker Compose file.
-
Or manually copy the contents of one of the folders in the
containers
directory into your project. You should be able to copy just the.devcontainer
folder and ignore everything else. See the definition'sREADME
for details.
You can share a customized dev container definition for your project by adding the files under .devcontainer
to source control. Anyone who then opens a local copy of your repo in VS Code will be prompted to reopen the folder in a container, provided they have the Remote Development extension pack installed.
Your team now has a consistent environment and tool-chain and new contributors or team members can be productive quickly. First-time contributors will require less guidance and there will be fewer issues related to environment setup.
Some dev container definitions include test assets. To test a definition:
- If this is your first time creating a dev container, follow the getting started steps to configure your machine.
- Browse the contents of the
containers
folder in this repository and pick one. Review theREADME
to see if there are any manual setup steps before continuing. - Clone this repository locally.
- Start VS Code, press F1, and run the Remote-Containers: Open Folder in Container... command.
- Select the root of the definition folder from the cloned repository when prompted (not the
test-project
folder if present). - See the definition's
README
for what to do next.
If you want to try a sample project which already has a dev container, check out one of the following repositories:
containers
- Contains reusable dev container definitions.container-templates
- Contains templates for creating your own container definitions or to contribute back.repository-containers
- Dev container definitions for working public source code repositories.
Yes, if you want to use an existing Dockerfile as a starting point, run Remote-Containers: Add Development Container Configuration Files... from the Command Palette (F1). You'll be prompted to select a Dockerfile or Docker Compose file and customize from there. If you prefer, you can also start up the container and attach to it.
A devcontainer.json
file is similar to launch.json
for debugging, but designed to launch (or attach to) a development container instead. At its simplest, all you need is a .devcontainer/devcontainer.json
file in your project that references an image, Dockerfile
, or docker-compose.yml
, and a few properties. You can adapt it for use in a wide variety of situations.
Have a question or feedback?
- Contribute or provide feedback for the VS Code Remote Development extensions.
- Search existing issues with dev container definitions or report a problem.
- Contribute a development container definition to the repository.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. See LICENSE.