Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Devcontainers Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-devcontainers-knowledge-patch)
---
name: devcontainers-knowledge-patch
description: Dev Containers
version: null
license: MIT
metadata:
author: Nevaberry
---
# Dev Containers
Use this skill when configuring Dev Containers, authoring Features or Templates,
working with Feature lockfiles, or using the Dev Container CLI.
Load the topic reference for the operation being performed.
| Reference | Topics |
| --- | --- |
| [Configuration and Runtime](references/configuration-and-runtime.md) | Configuration discovery, workspaces, metadata merges, users, environments, lifecycle hooks, engine compatibility |
| [Feature Authoring](references/feature-authoring.md) | Options, installers, dependencies, ordering, resource names, publishing, testing |
| [Feature Lockfiles and CLI](references/lockfiles-and-cli.md) | Lockfile operations and proposal records, installation, builds, caches, registry authentication, CLI arguments and output |
| [Template Authoring](references/template-authoring.md) | Layout, options, substitutions, optional paths, manifest metadata, releases |
## Deprecations and changed behavior
### Default lockfiles and deprecated flags
Starting in CLI 0.87.0, `build` and `up` generate Feature lockfiles by default.
Use `--no-lockfile` to skip generation or `--frozen-lockfile` to fail if the
lockfile is missing or would change. The old `--experimental-lockfile` and
`--experimental-frozen-lockfile` flags still work and emit deprecation warnings.
```sh
devcontainer build --no-lockfile
devcontainer up --frozen-lockfile
```
The CLI names the file `.devcontainer-lock.json`. The original lockfile proposal
uses `devcontainer-lock.json` alongside `devcontainer.json`; its record format
is described in [Feature Lockfiles and CLI](references/lockfiles-and-cli.md).
Starting in CLI 0.86.1, `--additional-features` entries are excluded from the
generated lockfile.
### Published tags and explicit image names
Starting in CLI 0.53.0, read `publishedTags` from `features info`,
`features publish`, and `templates publish`; earlier versions used
`publishedVersions`. Starting in CLI 0.61.0, `--image-name` suppresses the
automatically generated image name. Scripts that supply a name should use
that name to refer to the build output.
### Metadata representation
Starting in CLI 0.86.0, the CLI writes `devcontainer.metadata` as a JSON array,
even for one entry. The specification accepts a single JSON object as input.
When extending a prebuilt image, retain its existing metadata entries and
append separate snippets for each added Feature and the new build's
`devcontainer.json`.
### Dependency identifiers and planned commands
Deprecated release-based Feature identifiers are unsupported in `dependsOn`;
tools may reject or ignore `dependsOn` when it contains one.
The CLI lists `devcontainer stop` and `devcontainer down` as planned commands.
## Registry authentication and Docker arguments
CLI 0.89.0 adds `--oci-auth-hardening` to opt in to stricter OCI registry
authentication, with trusted cross-origin authentication host mappings and
diagnostics for assessing registry compatibility before rollout.
CLI 0.91.0 includes OCI authentication diagnostics in failed `devcontainer up`
results; blocked lookups report the lookup kind and why it was blocked.
Starting in CLI 0.39.0, credential sources for OCI Features and Templates are
checked in this order:
1. `DEVCONTAINERS_OCI_AUTH`
2. The Docker credential helper configured for the registry
3. The Docker credential store configured in Docker's config file
4. Credentials stored directly in Docker's config file
5. The platform's default credential helper
6. `GITHUB_TOKEN`
Starting in CLI 0.91.0, `--docker-arg` passes global options to the Docker CLI.
```sh
devcontainer up --workspace-folder . --docker-arg=--debug
```
## Inspecting and building
Run `devcontainer outdated` to see which locked Features have newer versions.
The `upgrade` command regenerates the Feature lockfile starting in CLI 0.52.0;
starting in 0.53.0, `--dry-run` previews the upgrade.
```sh
devcontainer upgrade --dry-run
```
CLI 0.61.0 accepts `--cache-from` and `--cache-to` on `devcontainer up` for
importing and exporting the build cache. Starting in 0.59.0,
`--build-no-cache` also disables the cache for the Feature build.
```sh
devcontainer up --cache-to type=local,dest=/tmp/devcontainer-cache
```
Starting in CLI 0.83.0, the build path that adds container Features uses
`BUILDKIT_INLINE_CACHE` to enable BuildKit's inline cache.
Starting in CLI 0.85.0, the CLI substitutes Buildx's global build- and
target-platform variables when resolving the Dockerfile's base image and user.
## Configuration and lifecycle readiness
Search the workspace source folder for `.devcontainer/devcontainer.json`, then
`.devcontainer.json`, then `.devcontainer/<folder>/devcontainer.json` with one
level of nesting. Multiple configurations may coexist, and tools can let users
select one. Starting in CLI 0.82.0, commands use the current directory when no
workspace folder is specified.
`waitFor` defaults to `updateContentCommand` and blocks readiness through the
selected creation hook. Tool setup can run while `postCreateCommand` is still
in the background; set `waitFor` to `postCreateCommand` if setup depends on it
finishing.
```json
{
"waitFor": "postCreateCommand"
}
```
A lifecycle hook object runs its named commands in parallel, and every command
must exit successfully for the hook to succeed. Feature hook contributions run
from the project workspace in Feature installation order, before the matching
hook in `devcontainer.json`. All commands in one Feature's object-form hook
finish before the next Feature or the user's hook begins.
`remoteEnv` is applied after the image's `ENTRYPOINT` and can change during the
container's lifetime. `userEnvProbe` collects variables using the configured
shell type; the tool merges them with the remote environment for injected
processes. `devcontainer exec` applies `userEnvProbe`, `remoteUser`, and
`remoteEnv` when running a command in the running dev container.
```sh
devcontainer exec --workspace-folder . env
```
## Feature installation and dependency resolution
Feature identifiers in `devcontainer.json` are case-insensitive and the Feature
spec calls for lowercasing them. The CLI redirects `devcontainers-contrib`
Feature references to `devcontainers-extra`; existing configurations can keep
the old publisher name.
Feature option IDs become environment variables in `install.sh`: replace
punctuation with underscores, collapse a leading run of digits and underscores
to one underscore, and uppercase the result. Unset options use manifest
defaults, and booleans arrive as the strings `true` and `false`.
A string-valued Feature entry supplies its `version` option; the package tag
and the installer option are separate values.
`dependsOn` recursively schedules required Features with specified options and
honors OCI tag or digest pins; creation fails if a dependency cannot be
installed. Direct HTTPS Feature tarball URLs are also supported as keys.
For locally authored Features, resolve relative dependency paths from the
directory containing the active `devcontainer.json`.
`installsAfter` uses unversioned IDs matched by canonical name, including renamed
Features. It applies only to Features already queued through configuration or
hard dependencies; a cycle among applicable ordering constraints should fail
resolution. `overrideFeatureInstallOrder` gives earlier unversioned IDs higher
priority across matching instances whose hard and applicable soft dependencies
are satisfied. An absent ID may cause resolution to fail.
One published Feature can run more than once with different options, so its
installer needs to tolerate repeated changes to shared state such as `PATH`.
OCI references deduplicate by manifest digest and executed option values;
HTTPS tarballs compare archive contents and executed option values. Local
Features are treated as distinct.
Directly selected Features and resolved dependencies are stored in image
metadata. Resuming the container or creating one from the existing image reuses
that resolution. Recreate from `devcontainer.json` without reusing the resolved
image to refresh the dependency graph.
## Template options and optional paths
Put `devcontainer-template.json` at the Template root and the required
configuration in `.devcontainer/devcontainer.json`. The manifest's `id` must
match the Template directory name and should be unique within its repository
or published package.
Declare `string` or `boolean` options and write defaults as strings, including
`"true"` and `"false"`. For string options, `proposals` suggests values while
allowing free-form input; `enum` restricts the allowed values. Tooling substitutes
`${templateOption:<id>}` in file contents before copying them into the workspace.
Declare `optionalPaths` relative to the Template root. Use a full relative file
path with no leading or trailing slash, or append `/*` to a directory path so
excluding it omits the directory and all descendants. Starting in CLI 0.68.0,
pass `--omit-paths` to `devcontainer templates apply` to leave out optional files
or directories.