Text of code.visualstudio.com › blogs › 2022 › 09 › 15 › dev-container-features as Styx crawled it on Nov 18, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

Custom Dev Container Features

Join VS Code at Microsoft Ignite or catch the sessions online. A year of VS Code, wrapped. Explore the highlights. On this page We've all had that moment when setting up our development environment – "Oh, I just need one more thing!" – that "thing" being one more language or toolset (or maybe a few more 😊) to work on your project. Development containers are a great way to simplify environment set up - they provide a complete coding environment with the tools your project needs.

They're configured using an image, Dockerfile, or Docker Compose file and devcontainer.json , which is a metadata format used to enrich containers with development specific content and settings. When creating dev containers, you may have the same "I just need one more thing!" reaction repeatedly – maybe you're using a Node.js image in your Dockerfile and just need to add Git. Or maybe you need to add something more complex, like working with Docker or Kubernetes from within your dev container.

Dev containers are great since anyone accessing your code will have the same, consistent experience with all those tools you added – but what's the best way to add them? What if there was an easy way to install that extra tool in your dev container, simply by mentioning the tool's name and version? Or what if as a tool user or author, you could create an easy way for others to install it? Sharing manual scripts can help with reuse, but when referencing one, you may forget to reference container or tooling settings, such as enabling ptrace support for Go, Rust, or C++ debugging, adding a specific entry point to fire on container start, or ensuring the right VS Code extensions are included.

Features We're happy to share that dev container Features help you smoothly get the tools you need in your dev container! Features are self-contained units of installation code, container configuration, and/or settings and extensions designed to enable new development capabilities in your dev container. They can be built to work with a wide range of base container images. As part of our work on the open dev container specification , we've made some improvements to where you can grab pre-created Features and how you can author and distribute your own.

Let's see what's new and how you can get started with Features from any dev container supporting tool or service (such as the VS Code Dev Containers extension or GitHub Codespaces )! Adding Features to your dev container Dev Container Features provide a quick way to associate dev container metadata with some install steps. You can add them to your dev containers through a simple reference. These Features can now be stored as OCI Artifacts in any supporting container registry, which means you can reference them using the same types of identifiers you would use to reference a container image.

We've moved some early Features that were in the vscode-dev-containers repository into a new devcontainers/features repository where they are published using this new approach. Referencing different Features from the devcontainers/features repository is as simple as adding a features property to your devcontainer.json . Each Feature has a README.md that shows how to reference the Feature and which options are available for it.

The example below installs the go and docker-in-docker Features: "name" : "my-project-devcontainer" , "image" : "mcr.microsoft.com/devcontainers/base:ubuntu" , "features" : { "ghcr.io/devcontainers/features/go:1" : { "version" : "1.18" }, "ghcr.io/devcontainers/features/docker-in-docker:1" : { "version" : "latest" , "moby" : true } } You can also explore official and publicly contributed Features on the specification site .

Any Feature can be added by editing devcontainer.json , and publicly published ones can be added through existing dev container configuration experiences (such as available in the VS Code Dev Containers extension). You can even use dev containers with Features from your favorite CI system using the dev container CLI , a GitHub Action, or an Azure DevOps task. We have a GitHub Action and Azure DevOps task available in the devcontainers/ci repository.

The dev container CLI, GitHub Action, or Azure DevOps task can also be used to pre-build images that include Feature contents to speed up start times. If you'd like to not only use publicly available Features but also create your own private or public ones to share, continue reading! Authoring A great place to get started with creating your own Features is the new Features template repository. Beyond including a good template for the contents of a given Feature, the template also includes a GitHub Actions workflow to quickly publish them too, using the GitHub Container Registry (GHCR) for your account to get you up and running as fast as possible.

We'll talk more about publishing in a minute. The source code of a Feature has two components: An install script ( install.sh ) and a configuration file ( devcontainer-feature.json ). +-- feature | +-- devcontainer-feature.json | +-- install.sh | +-- (other files) install.sh : The installation entry point script – it's conceptually added as a layer of the image's Dockerfile and executed during build-time. This entry point script can install tools such as languages (for example, Ruby) and tools (GitHub CLI). devcontainer-feature.json : This contains metadata about the Feature, a set of options that can be passed to a Feature's install script during installation, as well as "pieces" of devcontainer.json that will be merged into the final dev container.

For example, if any Feature indicates "privileged": true in their configuration, the entire dev container will be started with the --privileged flag. Features can be authored in a variety of languages, the most straightforward being shell scripts. If a Feature is authored in a different language, information about it should be included in the metadata so that users can make an informed choice about it. Note: While install.sh will run Features in any language, if you wrote a Feature in an interpreted language that wasn't present in the dev container, the code would fail to execute.

Be sure to acquire the language(s) you need as part of install.sh. You should be sure that Features you release publicly check and install dependencies in addition to the Feature. Furthermore, public Features are very likely to be used from both arm64 or x86_64 machines - so be sure to adapt to this when possible. You can review devcontainer-feature.json properties in the specification , along with public examples in the devcontainers/features repository.

Now that we've seen how to create a Feature, how can I distribute it to others? Distribution Features are distributed as tarballs. The tarball contains the entire contents of the Feature subdirectory, including the devcontainer-feature.json , install.sh , and any other files in the directory. The Open Container Initiative (OCI) defines industry standards for containers and container resources. We treat Features as OCI Artifacts and use the concept of an OCI Registry to distribute Features.

The Features template repository mentioned above includes a GitHub Actions workflow to automate the publishing process. It packages the Feature into a tarball and publishes the assets as an OCI artifact to GHCR. Trigger the release.yaml workflow from the template repository by selecting it on the left of the repository's Actions tab on GitHub. The GitHub Action will publish the Feature to GHCR under the <owner>/<repo> namespace.

A Feature is only republished when the version property in its devcontainer-feature.json is updated. Note: One manual step with GHCR is to mark the OCI package as "public" . This only has to be done once per Feature. Private Features do not require this step and may be accessed as long as you've logged into the Docker CLI using the credentials for your registry. Sharing your Features with the community If you'd like your contributions to appe

The rest of this page is on the live site.