A small collection of Dev Container Features
that extend the official anthropics/devcontainer-features/claude-code
feature with rtk and context-mode.
Published to Docker Hub under the sourecode namespace.
| Feature | OCI reference | Summary |
|---|---|---|
rtk |
docker.io/sourecode/rtk:1 |
Installs rtk, an LLM token-reducing CLI proxy; auto-patches Claude Code if present. |
context-mode |
docker.io/sourecode/context-mode:1 |
Installs the context-mode Claude Code plugin. |
Both features depend on the Claude Code CLI, which they declare via
installsAfter: ghcr.io/anthropics/devcontainer-features/claude-code so the
runtime orders installations automatically when Anthropic's feature is also
requested.
Add them to any .devcontainer/devcontainer.json, on top of whatever base
image you already use:
Features run inside the image during build (as root), installing into the
container's remoteUser home. After rebuild, the tools are available on the
user's PATH.
| Option | Type | Default | Purpose |
|---|---|---|---|
autoPatchClaude |
boolean | true |
Run rtk init -g --auto-patch to wire rtk's hook into Claude Code. No-op if the claude CLI is not on the user's PATH. |
No options. Fails if the claude CLI is not on the user's PATH — add the
official ghcr.io/anthropics/devcontainer-features/claude-code feature as
well (the installsAfter hint then makes the CLI resolve the correct install
order automatically).
Claude login (~/.claude/.credentials.json) and chat history (projects/,
sessions/, session-env/) are not persisted across rebuilds by default. See
docs/persistence.md for mount strategies (host login
bind mount, per-project credentials, or a shared named volume).
.github/workflows/
publish-features.yml # publishes every src/<id>/ to Docker Hub
src/
rtk/
devcontainer-feature.json
install.sh
context-mode/
devcontainer-feature.json
install.sh
docs/
persistence.md
Each feature directory follows the Dev Container Features spec:
a devcontainer-feature.json with metadata and options, plus an install.sh
that runs as root inside the container during the build.
install.shstarts asroot. To land files in the remote user's home, resolve the user via_REMOTE_USER/_REMOTE_USER_HOME(set by the devcontainer runtime) andsu - "$USER"for user-scoped steps.- Feature options are exposed as uppercased environment variables (e.g.
option
autoPatchClaude→$AUTOPATCHCLAUDE). Always apply a default:"${FOO:-true}". - The working directory when
install.shruns is the extracted feature folder, so sibling files are accessible via"$(dirname "$0")/...". - Don't assume the base image has any particular tools — install
curl,ca-certificates, etc. fromapt-getif absent. Keep installs idempotent where reasonable. - Declare dependencies with
installsAfterso the runtime orders features correctly (e.g. both features here listghcr.io/anthropics/devcontainer-features/claude-code).
Using the @devcontainers/cli:
npm i -g @devcontainers/cli
# Test a feature in isolation against a chosen base image:
devcontainer features test \
--features rtk \
--base-image debian:trixie-slim \
.mkdir -p src/<id>- Write
src/<id>/devcontainer-feature.jsonwithid,version,name,description,options, and optionalinstallsAfter. - Write
src/<id>/install.sh(make it executable:chmod +x install.sh). - Bump the
versionfor every change (MAJOR.MINOR.PATCH). The publish workflow pushes each declared version plus rollingMAJOR,MAJOR.MINOR, andlatesttags. - Commit to
master— thePublish Featuresworkflow runs on push and pushes todocker.io/sourecode/<id>:<tags>.
The Publish Features workflow (.github/workflows/publish-features.yml)
uses the official devcontainers/action@v1 with publish-features: true
and targets Docker Hub:
oci-registry: registry-1.docker.io(the real Docker Hub v2 endpoint —docker.ioreturns HTML for some unauthenticated calls)features-namespace: sourecode
Docker Hub uses flat namespace/repo paths (no nested subpaths), so each
feature publishes to docker.io/sourecode/<feature-id>.
Required repository secrets:
DOCKERHUB_USERNAME— the Docker Hub user or org that ownssourecode/*.DOCKERHUB_TOKEN— a Docker Hub access token withread, write, deletepermission on the target repositories.
The workflow triggers on pushes to master that touch src/** or the workflow
file, and can also be run manually via Run workflow in the Actions tab.
Update version in devcontainer-feature.json. Each push that lands in master
publishes:
docker.io/sourecode/<id>:<MAJOR>.<MINOR>.<PATCH>docker.io/sourecode/<id>:<MAJOR>.<MINOR>docker.io/sourecode/<id>:<MAJOR>docker.io/sourecode/<id>:latest
MIT — see LICENSE.
{ "image": "debian:trixie-slim", "features": { "ghcr.io/anthropics/devcontainer-features/claude-code:1": {}, "docker.io/sourecode/rtk:1": { "autoPatchClaude": true }, "docker.io/sourecode/context-mode:1": {} } }