LinuxCommandLibrary

devcontainer

CLI for managing development containers

TLDR

Build a dev container

$ devcontainer build --workspace-folder [.]
copy
Start a dev container
$ devcontainer up --workspace-folder [.]
copy
Execute command in container
$ devcontainer exec --workspace-folder [.] [command]
copy
Open shell in container
$ devcontainer exec --workspace-folder [.] bash
copy
Read configuration
$ devcontainer read-configuration --workspace-folder [.]
copy
List features
$ devcontainer features list
copy
Generate templates
$ devcontainer templates apply -t [python]
copy

SYNOPSIS

devcontainer command [options]

DESCRIPTION

devcontainer is the CLI for managing development containers defined by the Dev Container specification. It allows building, running, and interacting with containerized development environments from the command line.
Dev containers provide reproducible development environments using Docker containers. Configuration in .devcontainer/devcontainer.json defines the container image, extensions, settings, and features needed for a project.
The CLI enables dev container workflows without IDE integration, useful for CI/CD pipelines, remote development, and automation of development environment setup.

PARAMETERS

COMMAND

Operation: build, up, exec, read-configuration, features, templates.
--workspace-folder PATH
Path to workspace with .devcontainer config.
build
Build the dev container image.
up
Create and start the container.
exec COMMAND
Run command in container.
read-configuration
Output resolved configuration.
features list
List available dev container features.
--help
Display help information.

CONFIGURATION

.devcontainer/devcontainer.json

Configuration file defining container image, features, extensions, and environment settings.

CAVEATS

Requires Docker or compatible container runtime. Configuration must follow Dev Container spec. Some features require specific base images. Resource-intensive for complex environments.

HISTORY

The Dev Container CLI was released by Microsoft as part of the Dev Containers specification (2022). It extends the VS Code Dev Containers functionality to command-line workflows and other tools.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community