Declarative configuration describes the desired development environment while leaving the setup workflow to supporting tools. In Devcontainers, a devcontainer.json records the base image, features, language version, and editor extensions, reducing manual setup and limiting “it works on my machine” differences. section 2.2.5
A practical configuration can define:
- The container image and development tools. section 2.2.5
- Language features, versions, and distributions. section 2.2.5
- IDE customizations such as extensions. section 2.2.5
Devcontainer activation
A project containing devcontainer.json can be opened in Visual Studio Code, which activates a containerized environment containing the configured dependencies. Declarative files may be combined with imperative Dockerfiles when additional setup steps are required. section 2.2.5
Listing 2.2 Example of Devcontainers configuration file.
{
"name": "Java", #A
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-24.04", #B
"features": { #C
"ghcr.io/devcontainers/features/java:1": {
"version": "24", #D
"jdkDistro": "graalce"
},
},
"customizations": { #E
"vscode": {
"extensions": [ #F
"vscjava.vscode-java-pack",
"redhat.vscode-yaml",
]
}
}
}
Inspect a complete configuration declaring an Ubuntu base image, Java 24 with GraalCE, and Visual Studio Code extensions. section 2.2.5






