liveBook · Manning

Declarative configuration

As explained in Developer Experience on Kubernetes

Declarative configuration specifies the desired state of a system without prescribing the procedural steps used to achieve it.

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:

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

How Developer Experience on Kubernetes covers it

How deep it goes
Explains configuration fields and the declarative-imperative boundary, but does not detail configuration processing internals.
Examples
Uses a Java Devcontainer declaring an Ubuntu image, Java 24, GraalCE, and Visual Studio Code extensions.
What you can do after
Operate Devcontainers by defining reproducible tools, language features, and editor settings in configuration.
How it connects
Connects Devcontainers with Dockerfiles, OCI images, container runtimes, Kubernetes, cloud platforms, and IDEs.

Also explained in

Compare how 7 books explain declarative configuration →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Developer Experience on Kubernetes. The section links point to the parts of the book it draws on.