Author : MD TAREQ HASSAN | Updated : 2023/07/24
Inroduction
- devcontainer features are a set of simple and reusable Features
- Things that are not included in base image, can be installed using feature
- ‘Features’ are self-contained units of installation code and development container configuration
- Features are designed to install atop a wide-range of base container images.
- This property is used to specify a list of features that you want to include in the development environment
- Quickly add a language/tool/CLI to a development container
- Add more tools, runtime etc. as a feature
Each feature corresponds to a specific set of tools, extensions, or configurations that you want to add to the Devcontainer
Example
Lets say we want to create a devcontainer for nodejs and typescript. And, we also want powershell & azure-cli to be installed in that devcontainer.
devcontainer.json
{
"name": "Node.js & TypeScript",
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye",
"features": {
"ghcr.io/devcontainers/features/azure-cli:1": {},
"ghcr.io/devcontainers/features/powershell:1": {}
}
}
Update features of existing configuration
“Dev Containers: Configure Container Features” command allows you to update an existing configuration
official and community-supported Dev Container Features
- Get official features: https://containers.dev/features
- Github repo: https://github.com/devcontainers/features/tree/main/src
Custom feature
We can create out own feature, See: https://github.com/devcontainers/feature-starter