Features Documentation

Official Shell developer resources and documentation for marmelab/Features. Verified technical context for AI.

0 stars Shell Shell 3 files ยท ~2,997 tokens
RAW Doc

Technical Documentation: marmelab/Features

โ„น๏ธ Provenance: Multi-Tier Ingestion ยท CodeWiki Reference

Overview (`README.md`)

Marmelab Dev Container Features

A collection of custom dev container Features, published to GitHub Container Registry following the dev container Feature distribution specification.

Features

`claude-code`

Installs the Claude Code CLI and, in VS Code, the Claude Code extension. See src/claude-code.

jsonc
{
  "image": "mcr.microsoft.com/devcontainers/base:ubuntu",
  "features": {
    "ghcr.io/marmelab/devcontainers/claude-code:1": {},
  },
}
bash
$ claude --version

Repository structure

Each published Feature lives in its own sub-folder under src, containing a devcontainer-feature.json, an entrypoint install.sh, and a README.md. Tests live under test/<feature>.

text
โ”œโ”€โ”€ src
โ”‚   โ””โ”€โ”€ claude-code
โ”‚       โ”œโ”€โ”€ devcontainer-feature.json
โ”‚       โ”œโ”€โ”€ install.sh
โ”‚       โ””โ”€โ”€ README.md
โ”œโ”€โ”€ test
โ”‚   โ””โ”€โ”€ claude-code
โ”‚       โ”œโ”€โ”€ test.sh
โ”‚       โ”œโ”€โ”€ non_root_user.sh
โ”‚       โ””โ”€โ”€ scenarios.json
โ””โ”€โ”€ .devcontainer
    โ””โ”€โ”€ claude-code            # local dogfood copy (see below)

Developing this repository

This repo's own Dev Container installs Claude Code via a local copy of the feature at .devcontainer/claude-code. It is a separate copy because the Dev Container CLI only resolves local features inside the .devcontainer/ folder, so the published src/claude-code cannot be referenced directly. Keep the two in sync. Credential mounts for the container are declared in .devcontainer/devcontainer.json.

An implementing tool will composite the documented dev container properties from the feature's devcontainer-feature.json file, and execute in the install.sh entrypoint script in the container during build time. Implementing tools are also free to process attributes under the customizations property as desired.

Options

All available options for a Feature should be declared in the devcontainer-feature.json. The syntax for the options property can be found in the devcontainer Feature json properties reference.

For example, the claude-code feature exposes a version option. If no option is provided in a user's devcontainer.json, the value falls back to its default (latest).

jsonc
{
  // ...
  "options": {
    "version": {
      "type": "string",
      "proposals": ["latest", "stable"],
      "default": "latest",
      "description": "Version passed to the official installer.",
    },
  },
}

Options are exported as Feature-scoped environment variables. The option name is capitalized and sanitized according to option resolution.

bash
#!/bin/bash

echo "Activating feature 'claude-code' (version: ${VERSION})"

...

Distributing Features

Versioning

Features are individually versioned by the version attribute in a Feature's devcontainer-feature.json. Features are versioned according to the semver specification. More details can be found in the dev container Feature specification.

Publishing

NOTE: The Distribution spec can be found here.

While any registry implementing the OCI Distribution spec can be used, this template will leverage GHCR (GitHub Container Registry) as the backing registry.

Features are meant to be easily sharable units of dev container configuration and installation code.

This repo contains a GitHub Action workflow that will publish each Feature to GHCR.

Allow GitHub Actions to create and approve pull requests should be enabled in the repository's Settings > Actions > General > Workflow permissions for auto generation of src/<feature>/README.md per Feature (which merges any existing src/<feature>/NOTES.md).

By default, each Feature will be prefixed with the <owner>/<repo> namespace. For example, the Features in this repository can be referenced in a devcontainer.json with:

text
ghcr.io/marmelab/devcontainers/claude-code:1

The provided GitHub Action will also publish a "metadata" package with just the namespace, eg: ghcr.io/marmelab/devcontainers. This contains information useful for tools aiding in Feature discovery.

'marmelab/devcontainers' is known as the feature collection namespace.

Marking Feature Public

Note that by default, GHCR packages are marked as private. To stay within the free tier, Features need to be marked as public.

This can be done by navigating to the Feature's "package settings" page in GHCR, and setting the visibility to 'public`. The URL may look something like:

text
https://github.com/users/<owner>/packages/container/<repo>%2F<featureName>/settings

Adding Features to the Index

If you'd like your Features to appear in our public index so that other community members can find them, you can do the following:

This index is from where supporting tools like VS Code Dev Containers and GitHub Codespaces surface Features for their dev container creation UI.

Using private Features in Codespaces

For any Features hosted in GHCR that are kept private, the GITHUB_TOKEN access token in your environment will need to have package:read and contents:read for the associated repository.

Many implementing tools use a broadly scoped access token and will work automatically. GitHub Codespaces uses repo-scoped tokens, and therefore you'll need to add the permissions in devcontainer.json

An example devcontainer.json can be found below.

jsonc
{
  "image": "mcr.microsoft.com/devcontainers/base:ubuntu",
  "features": {
    "ghcr.io/my-org/private-features/hello:1": {
      "greeting": "Hello",
    },
  },
  "customizations": {
    "codespaces": {
      "repositories": {
        "my-org/private-features": {
          "permissions": {
            "packages": "read",
            "contents": "read",
          },
        },
      },
    },
  },
}

Overview (`src/claude-code/README.md`)

Claude Code (claude-code)

Installs the Claude Code CLI (and, in VS Code, the Claude Code extension).

Example Usage

json
"features": {
    "ghcr.io/marmelab/devcontainers/claude-code:1": {}
}

Options

Options Id Description Type Default Value
version Version passed to the official installer: 'latest', 'stable', or a specific version such as '1.0.0'. string latest

What it does

  • Downloads and runs the official installer from https://claude.ai/install.sh as the container user.
  • Symlinks the CLI into /usr/local/bin so it is on PATH in login, non-interactive, and CI shells, and adds $HOME/.local/bin to ~/.bashrc and ~/.zshrc for interactive shells.
  • In VS Code, installs the Anthropic.claude-code extension.

Installs curl and CA certificates first if they are missing (Debian/Ubuntu bases).

Using your Claude credentials

The feature does not mount credentials, because bind mounts are host-specific and
belong in the consuming devcontainer.json. To authenticate Claude Code inside the
container from your host setup, add the mounts yourself:

jsonc
{
  "features": {
    "ghcr.io/marmelab/devcontainers/claude-code:1": {},
  },
  "mounts": [
    {
      "type": "bind",
      "source": "${localEnv:HOME}/.claude.json",
      "target": "/home/<user>/.claude.json",
    },
    {
      "type": "bind",
      "source": "${localEnv:HOME}/.claude",
      "target": "/home/<user>/.claude",
    },
  ],
}

Replace `` with your container user (for example node or vscode). The host
~/.claude.json file and ~/.claude directory must already exist, otherwise the bind
mount fails the container build.


Overview (`src/playwright/README.md`)

Playwright integration

Installs Playwright system dependencies (via the playwright-deps feature) and
persists downloaded browsers in a named volume across container rebuilds.

See install.sh, install-browsers.sh, and
devcontainer-feature.json.

Options

Option Type Default Description
browsers string chromium,firefox,webkit Comma-separated browsers to download at container creation. Use all for every browser, or none to skip the download.
jsonc
{
  "features": {
    "./playwright": { "browsers": "chromium" },
  },
}

The selected browsers are downloaded by install-browsers.sh
(run via postStartCommand), which reads the selection persisted by
install.sh and calls npx playwright install. It runs at post-start rather
than post-create because
Feature lifecycle commands always run before the user's own commands of the
same stage: a post-create hook here would fire before your npm install, so
playwright would not exist yet. The download uses npx --no-install, so it
only ever uses the project's own playwright and skips cleanly (with a hint) if
none is installed, instead of fetching an arbitrary version from the registry.

System dependencies

OS-level browser dependencies are installed at build time by the
playwright-deps
feature, declared in dependsOn. Per the dev container spec, dependsOn values
are static and cannot reference this feature's options, so dependencies for all
three browsers are always installed regardless of the browsers option. The
option only controls which browser binaries are downloaded (the main disk and
time cost).

Cache folder

Browsers are cached at PLAYWRIGHT_BROWSERS_PATH (default /mnt/ms-playwright).
To change the folder, override this env var in your devcontainer.json; the
volume mount follows automatically:

jsonc
{
  "features": { "./playwright": {} },
  "containerEnv": { "PLAYWRIGHT_BROWSERS_PATH": "/custom/path" },
}

--- METRICS ---