Type object
Schema URL https://catalog.lintel.tools/schemas/schemastore/devcontainer-json/_shared/latest--devContainer.base.schema.json
Parent schema devcontainer-json
Type: object

Defines a dev container

One of

1. variant
2. devContainerCommon object

Definitions

devContainerCommon object
$schema string

The JSON schema of the devcontainer.json file.

format=uri
name string

A name for the dev container which can be displayed to the user.

features object

Features to add to the dev container.

5 nested properties
fish
maven
gradle
homebrew
jupyterlab
overrideFeatureInstallOrder string[]

Array consisting of the Feature id (without the semantic version) of Features in the order the user wants them to be installed.

secrets object

Recommended secrets for this dev container. Recommendations are provided as environment variable keys with optional metadata.

forwardPorts integer | string[]

Ports that are forwarded from the container to the local machine. Can be an integer port number, or a string of the format "host:port_number".

portsAttributes object

Set default properties that are applied when a specific port number is forwarded. For example:

"3000": {
  "label": "Application"
},
"40000-55000": {
  "onAutoForward": "ignore"
},
".+\\/server.js": {
 "onAutoForward": "openPreview"
}
otherPortsAttributes object

Set default properties that are applied to all ports that don't get properties from the setting remote.portsAttributes. For example:

{
  "onAutoForward": "ignore"
}
5 nested properties
onAutoForward string

Defines the action that occurs when the port is discovered for automatic forwarding

Default: "notify"
Values: "notify" "openBrowser" "openPreview" "silent" "ignore"
elevateIfNeeded boolean

Automatically prompt for elevation (if needed) when this port is forwarded. Elevate is required if the local port is a privileged port.

Default: false
label string

Label that will be shown in the UI for this port.

Default: "Application"
requireLocalPort boolean

When true, a modal dialog will show if the chosen local port isn't used for forwarding.

Default: false
protocol string

The protocol to use when forwarding this port.

Values: "http" "https"
updateRemoteUserUID boolean

Controls whether on Linux the container's user should be updated with the local user's UID and GID. On by default when opening from a local folder.

containerEnv Record<string, string>

Container environment variables.

containerUser string

The user the container will be started with. The default is the user on the Docker image.

mounts Mount | string[]

Mount points to set up when creating the container. See Docker's documentation for the --mount option for the supported syntax.

init boolean

Passes the --init flag when creating the dev container.

privileged boolean

Passes the --privileged flag when creating the dev container.

capAdd string[]

Passes docker capabilities to include when creating the dev container.

Examples: "SYS_PTRACE"
securityOpt string[]

Passes docker security options to include when creating the dev container.

Examples: "seccomp=unconfined"
remoteEnv Record<string, string | null>

Remote environment variables to set for processes spawned in the container including lifecycle scripts and any remote editor/IDE server process.

remoteUser string

The username to use for spawning processes in the container including lifecycle scripts and any remote editor/IDE server process. The default is the same user as the container.

initializeCommand Record<string, string | array>

A command to run locally (i.e Your host machine, cloud VM) before anything else. This command is run before "onCreateCommand". If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell. If this is an object, each provided command will be run in parallel.

onCreateCommand Record<string, string | array>

A command to run when creating the container. This command is run after "initializeCommand" and before "updateContentCommand". If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell. If this is an object, each provided command will be run in parallel.

updateContentCommand Record<string, string | array>

A command to run when creating the container and rerun when the workspace content was updated while creating the container. This command is run after "onCreateCommand" and before "postCreateCommand". If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell. If this is an object, each provided command will be run in parallel.

postCreateCommand Record<string, string | array>

A command to run after creating the container. This command is run after "updateContentCommand" and before "postStartCommand". If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell. If this is an object, each provided command will be run in parallel.

postStartCommand Record<string, string | array>

A command to run after starting the container. This command is run after "postCreateCommand" and before "postAttachCommand". If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell. If this is an object, each provided command will be run in parallel.

postAttachCommand Record<string, string | array>

A command to run when attaching to the container. This command is run after "postStartCommand". If this is a single string, it will be run in a shell. If this is an array of strings, it will be run as a single command without shell. If this is an object, each provided command will be run in parallel.

waitFor string

The user command to wait for before continuing execution in the background while the UI is starting up. The default is "updateContentCommand".

Values: "initializeCommand" "onCreateCommand" "updateContentCommand" "postCreateCommand" "postStartCommand"
userEnvProbe string

User environment probe to run. The default is "loginInteractiveShell".

Values: "none" "loginShell" "loginInteractiveShell" "interactiveShell"
hostRequirements object

Host hardware requirements.

4 nested properties
cpus integer

Number of required CPUs.

min=1
memory string

Amount of required RAM in bytes. Supports units tb, gb, mb and kb.

pattern=^\d+([tgmk]b)?$
storage string

Amount of required disk space in bytes. Supports units tb, gb, mb and kb.

pattern=^\d+([tgmk]b)?$
gpu boolean | string | object
customizations object

Tool-specific configuration. Each tool should use a JSON object subproperty with a unique name to group its customizations.

additionalProperties object
nonComposeBase object
appPort integer | string | array

Application ports that are exposed by the container. This can be a single port or an array of ports. Each port can be a number or a string. A number is mapped to the same port on the host. A string is passed to Docker unchanged and can be used to map ports differently, e.g. "8000:8010".

runArgs string[]

The arguments required when starting in the container.

shutdownAction string

Action to take when the user disconnects from the container in their editor. The default is to stop the container.

Values: "none" "stopContainer"
overrideCommand boolean

Whether to overwrite the command specified in the image. The default is true.

workspaceFolder string

The path of the workspace folder inside the container.

workspaceMount string

The --mount parameter for docker run. The default is to mount the project folder at /workspaces/$project.

dockerfileContainer object
buildOptions object
target string

Target stage in a multi-stage build.

args Record<string, string>

Build arguments.

cacheFrom string | array

The image to consider as a cache. Use an array to specify multiple images.

options string[]

Additional arguments passed to the build command.

imageContainer object
image string required

The docker image that will be used to create the container.

composeContainer object
dockerComposeFile string | array required

The name of the docker-compose file(s) used to start the services.

service string required

The service you want to work on. This is considered the primary container for your dev environment which your editor will connect to.

workspaceFolder string required

The path of the workspace folder inside the container. This is typically the target path of a volume mount in the docker-compose.yml.

runServices string[]

An array of services that should be started and stopped.

shutdownAction string

Action to take when the user disconnects from the primary container in their editor. The default is to stop all of the compose containers.

Values: "none" "stopCompose"
overrideCommand boolean

Whether to overwrite the command specified in the image. The default is false.

Mount object
type string required

Mount type.

Values: "bind" "volume"
target string required

Mount target.

source string

Mount source.