NOTE: Most of the contents of this repository have been migrated to the new devcontainers GitHub org (https://github.com/devcontainers). See https://github.com/devcontainers/template-starter and https://github.com/devcontainers/feature-starter for information on creating your own!
Перейти к файлу
Chuck Lantz f2d3ec2ca9
Prep for Ubuntu 22.04/Jammy release (including C++ definitions) (#1399)
* Ubuntu 22.04/Jammy

* Adjust C++ definitions for Ubuntu Jammy

* Stick with codenames for image generation

* Stick with codenames for image generation

* Fix references

* bump manifest for cpp

Co-authored-by: Josh Spicer <josh@joshspicer.com>
2022-04-22 08:03:16 -04:00
.devcontainer Final fix for not showing WSL prompt 2022-04-05 15:07:54 +00:00
.github Separate PR tests for different distros 2022-03-07 22:09:46 +00:00
.vscode Added note on the new recommended extension 2021-06-25 20:07:24 +00:00
build Prep for Ubuntu 22.04/Jammy release (including C++ definitions) (#1399) 2022-04-22 08:03:16 -04:00
container-templates Fixing typos (#1312) 2022-02-17 06:29:27 -08:00
containers Prep for Ubuntu 22.04/Jammy release (including C++ definitions) (#1399) 2022-04-22 08:03:16 -04:00
migrations tool to convert README metadata to json. (#1332) 2022-03-02 15:09:24 -05:00
repository-containers Automated update for image history 2022-04-11 17:25:15 +00:00
script-library Prep for Ubuntu 22.04/Jammy release (including C++ definitions) (#1399) 2022-04-22 08:03:16 -04:00
.editorconfig Fix LF 2019-06-13 20:59:45 +00:00
.gitattributes Fix typo 2019-09-05 12:15:41 -04:00
.gitignore merge features.json exploration (#1009) 2021-08-23 12:26:21 -04:00
CONTRIBUTING.md Update extra 's' in CONTRIBUTING.md (#1387) 2022-04-01 06:38:11 -07:00
LICENSE Initial commit 2018-11-05 04:52:41 -08:00
NOTICE.txt Start of JDK 17 support, build system support for multiple build args for a variant (#1113) 2021-10-15 10:06:21 -07:00
README.md Add repository containers docs link (#1321) 2022-02-24 15:08:09 -08:00
SECURITY.md Add SECURITY.md 2021-03-24 06:50:56 -07:00
SUPPORT.md Correct link 2021-10-20 18:23:11 -07:00
azure-pipelines.yml Update azure-pipelines.yml for Azure Pipelines 2021-12-10 09:09:23 -08:00
cgmanifest.json Automated update for image history 2022-04-11 17:25:15 +00:00
devcontainer-collection.json Update devcontainer-collection.json 2022-03-03 18:37:21 -05:00
package.json 0.231.6 2022-04-12 23:05:33 +00:00
yarn.lock Bump minimist from 1.2.5 to 1.2.6 (#1378) 2022-03-25 09:32:40 -05:00

README.md

VS Code Remote / GitHub Codespaces Container Definitions

Visual Studio Code logo Visual Studio Code Remote Development and GitHub Codespaces
Open your code in the cloud, in a local container, on a remote machine, or in WSL and take advantage of VS Code's full feature set.

A development container is a running Docker container with a well-defined tool/runtime stack and its prerequisites. The VS Code Remote - Containers extension and GitHub Codespaces allow you to open or clone code in a local or cloud-hosted 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. You can use the the Add Development Container Configuration Files... command to add one to your project or codespace.

The vscode-remote-try-* repositories may also be of interest if you are looking for complete sample projects.

Adding a definition to a project or codespace

  1. Either create a codespace for your repository or set up your local machine for use with the Remote - Containers extension, start VS Code, and open your project folder.
  2. Press F1, and select the Add Development Container Configuration Files... command for Remote-Containers or Codespaces.
  3. Pick one of the recommended definitions from the list or select Show All Definitions... to see all of them. You may need to choose the From a predefined container configuration definition... option if your project has an existing Dockerfile or Docker Compose file. Answer any questions that appear.
  4. See the definition's README for configuration options. A link is available in the .devcontainer/devcontainer.json file added to your folder.
  5. Run Remote-Containers: Reopen in Container to use it locally, or Codespaces: Rebuild Container from within a codespace.

Adding a definition to a repository

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 - Containers extension installed. Additionally, this will be used whenever someone creates a codespace in GitHub Codespaces for the repository.

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.

Sample projects

If you want to try a sample project which already has a dev container, check out one of the following repositories:

Contents

Common Questions

Can I just reuse an existing container image or Docker / Docker Compose configuration?

Yes! If you have a Dockerfile or Docker Compose file in your project/repository, follow the same steps to add a definition and you'll be prompted to select a Dockerfile or Docker Compose file and customize from there. If you then commit these files to a Git repository, you can use it with GitHub Codespaces as well. If you prefer, you can also start up the container manually and attach to it. However, note that many images will be missing things like git that you will want to use. There are scripts in the script-library like the common script that can help adding these to your existing Dockerfile or image.

What is the goal of devcontainer.json?

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.

Why do Dockerfiles in this repo use RUN statements with commands separated by &&?

Each RUN statement creates a Docker image "layer". If one RUN statement adds temporary contents, these contents remain in this layer in the image even if they are deleted in a subsequent RUN. This means the image takes more storage locally and results in slower image download times if you publish the image to a registry. You can resolve this problem by using a RUN statement that includes any clean up steps (separated by &&) after a given operation. See CONTRIBUTING.md for more tips.

Contributing and feedback

Have a question or feedback?

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.

License

Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the MIT License. See LICENSE.

For images generated from this repository, see LICENSE and NOTICE.txt.