Skip to content

devcontainer.json base Schema

Download JSON Schema

Base Dev Container

Defines a dev container

Type: object(?)


Definitions

devContainerCommon

No description provided for this model.

Type: object

PropertyTypeRequiredPossible valuesDeprecatedDefaultDescriptionExamples
$schemastringFormat: uriThe JSON schema of the devcontainer.json file.
namestringstringA name for the dev container which can be displayed to the user.
featuresobjectobjectFeatures to add to the dev container.
overrideFeatureInstallOrderarraystringArray consisting of the Feature id (without the semantic version) of Features in the order the user wants them to be installed.
secretsobjectobjectRecommended secrets for this dev container. Recommendations are provided as environment variable keys with optional metadata.
forwardPortsarray0 <= x <= 65535 or ^([a-z0-9-]+):(\d{1,5})$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 ”.
portsAttributesobjectobject
otherPortsAttributesobjectobject
updateRemoteUserUIDbooleanbooleanControls 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.
containerEnvobjectobjectContainer environment variables.
containerUserstringstringThe user the container will be started with. The default is the user on the Docker image.
mountsarrayMount and/or stringMount points to set up when creating the container. See Docker’s documentation for the —mount option for the supported syntax.
initbooleanbooleanPasses the —init flag when creating the dev container.
privilegedbooleanbooleanPasses the —privileged flag when creating the dev container.
capAddarraystringPasses docker capabilities to include when creating the dev container.SYS_PTRACE
securityOptarraystringPasses docker security options to include when creating the dev container.seccomp=unconfined
remoteEnvobjectobjectRemote environment variables to set for processes spawned in the container including lifecycle scripts and any remote editor/IDE server process.
remoteUserstringstringThe 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['string', 'array', 'object']stringA 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['string', 'array', 'object']stringA 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['string', 'array', 'object']stringA 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['string', 'array', 'object']stringA 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['string', 'array', 'object']stringA 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['string', 'array', 'object']stringA 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.
waitForstringinitializeCommand onCreateCommand updateContentCommand postCreateCommand postStartCommandThe user command to wait for before continuing execution in the background while the UI is starting up. The default is “updateContentCommand”.
userEnvProbestringnone loginShell loginInteractiveShell interactiveShellUser environment probe to run. The default is “loginInteractiveShell”.
hostRequirementsobjectobjectHost hardware requirements.
customizationsobjectobjectTool-specific configuration. Each tool should use a JSON object subproperty with a unique name to group its customizations.
additionalPropertiesobjectobject

nonComposeBase

No description provided for this model.

Type: object

PropertyTypeRequiredPossible valuesDeprecatedDefaultDescriptionExamples
appPort['integer', 'string', 'array'][‘integer’, ‘string’]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”.
runArgsarraystringThe arguments required when starting in the container.
shutdownActionstringnone stopContainerAction to take when the user disconnects from the container in their editor. The default is to stop the container.
overrideCommandbooleanbooleanWhether to overwrite the command specified in the image. The default is true.
workspaceFolderstringstringThe path of the workspace folder inside the container.
workspaceMountstringstringThe —mount parameter for docker run. The default is to mount the project folder at /workspaces/$project.

dockerfileContainer

No description provided for this model.

Type: object(?)

buildOptions

No description provided for this model.

Type: object

PropertyTypeRequiredPossible valuesDeprecatedDefaultDescriptionExamples
targetstringstringTarget stage in a multi-stage build.
argsobjectobjectBuild arguments.
cacheFrom['string', 'array']stringThe image to consider as a cache. Use an array to specify multiple images.
optionsarraystringAdditional arguments passed to the build command.

imageContainer

No description provided for this model.

Type: object

PropertyTypeRequiredPossible valuesDeprecatedDefaultDescriptionExamples
imagestringstringThe docker image that will be used to create the container.

composeContainer

No description provided for this model.

Type: object

PropertyTypeRequiredPossible valuesDeprecatedDefaultDescriptionExamples
dockerComposeFile['string', 'array']stringThe name of the docker-compose file(s) used to start the services.
servicestringstringThe service you want to work on. This is considered the primary container for your dev environment which your editor will connect to.
workspaceFolderstringstringThe path of the workspace folder inside the container. This is typically the target path of a volume mount in the docker-compose.yml.
runServicesarraystringAn array of services that should be started and stopped.
shutdownActionstringnone stopComposeAction to take when the user disconnects from the primary container in their editor. The default is to stop all of the compose containers.
overrideCommandbooleanbooleanWhether to overwrite the command specified in the image. The default is false.

Mount

No description provided for this model.

Type: object

⚠️ Additional properties are not allowed.

PropertyTypeRequiredPossible valuesDeprecatedDefaultDescriptionExamples
typestringbind volumeMount type.
targetstringstringMount target.
sourcestringstringMount source.