Environment Variables

May 22, 2026 ยท View on GitHub

FlagEnvironment variableDefaultDescription
--setup-scriptENVBUILDER_SETUP_SCRIPTThe script to run before the init script. It runs as the root user regardless of the user specified in the devcontainer.json file. SetupScript is ran as the root user prior to the init script. It is used to configure envbuilder dynamically during the runtime. e.g. specifying whether to start systemd or tiny init for PID 1.
--init-scriptENVBUILDER_INIT_SCRIPTThe script to run to initialize the workspace. Default: sleep infinity.
--init-commandENVBUILDER_INIT_COMMANDThe command to run to initialize the workspace. Default: /bin/sh.
--init-argsENVBUILDER_INIT_ARGSThe arguments to pass to the init command. They are split according to /bin/sh rules with https://github.com/kballard/go-shellquote.
--cache-repoENVBUILDER_CACHE_REPOThe name of the container registry to push the cache image to. If this is empty, the cache will not be pushed.
--base-image-cache-dirENVBUILDER_BASE_IMAGE_CACHE_DIRThe path to a directory where the base image can be found. This should be a read-only directory solely mounted for the purpose of caching the base image.
--layer-cache-dirENVBUILDER_LAYER_CACHE_DIRThe path to a directory where built layers will be stored. This spawns an in-memory registry to serve the layers from.
--devcontainer-dirENVBUILDER_DEVCONTAINER_DIRThe path to the folder containing the devcontainer.json file that will be used to build the workspace and can either be an absolute path or a path relative to the workspace folder. If not provided, defaults to .devcontainer.
--devcontainer-json-pathENVBUILDER_DEVCONTAINER_JSON_PATHThe path to a devcontainer.json file that is either an absolute path or a path relative to DevcontainerDir. This can be used in cases where one wants to substitute an edited devcontainer.json file for the one that exists in the repo.
--dockerfile-pathENVBUILDER_DOCKERFILE_PATHThe relative path to the Dockerfile that will be used to build the workspace. This is an alternative to using a devcontainer that some might find simpler.
--build-context-pathENVBUILDER_BUILD_CONTEXT_PATHCan be specified when a DockerfilePath is specified outside the base WorkspaceFolder. This path MUST be relative to the WorkspaceFolder path into which the repo is cloned.
--cache-ttl-daysENVBUILDER_CACHE_TTL_DAYSThe number of days to use cached layers before expiring them. Defaults to 7 days.
--docker-config-base64ENVBUILDER_DOCKER_CONFIG_BASE64The base64 encoded Docker config file that will be used to pull images from private container registries. When this is set, Docker configuration set via the DOCKER_CONFIG environment variable is ignored.
--fallback-imageENVBUILDER_FALLBACK_IMAGESpecifies an alternative image to use when neither an image is declared in the devcontainer.json file nor a Dockerfile is present. If there's a build failure (from a faulty Dockerfile) or a misconfiguration, this image will be the substitute. Set ExitOnBuildFailure to true to halt the container if the build faces an issue.
--exit-on-build-failureENVBUILDER_EXIT_ON_BUILD_FAILURETerminates the container upon a build failure. This is handy when preferring the FALLBACK_IMAGE in cases where no devcontainer.json or image is provided. However, it ensures that the container stops if the build process encounters an error.
--exit-on-push-failureENVBUILDER_EXIT_ON_PUSH_FAILUREExitOnPushFailure terminates the container upon a push failure. This is useful if failure to push the built image should abort execution and result in an error.
--force-safeENVBUILDER_FORCE_SAFEIgnores any filesystem safety checks. This could cause serious harm to your system! This is used in cases where bypass is needed to unblock customers.
--insecureENVBUILDER_INSECUREBypass TLS verification when cloning and pulling from container registries.
--ignore-pathsENVBUILDER_IGNORE_PATHSThe comma separated list of paths to ignore when building the workspace.
--build-secretsENVBUILDER_BUILD_SECRETSThe list of secret environment variables to use when building the image.
--skip-rebuildENVBUILDER_SKIP_REBUILDSkip building if the MagicFile exists. This is used to skip building when a container is restarting. e.g. docker stop -> docker start This value can always be set to true - even if the container is being started for the first time.
--git-urlENVBUILDER_GIT_URLThe URL of a Git repository containing a Devcontainer or Docker image to clone. This is optional.
--git-clone-depthENVBUILDER_GIT_CLONE_DEPTHThe depth to use when cloning the Git repository.
--git-clone-single-branchENVBUILDER_GIT_CLONE_SINGLE_BRANCHClone only a single branch of the Git repository.
--git-clone-thinpackENVBUILDER_GIT_CLONE_THINPACKtrueGit clone with thin pack compatibility enabled, ensuring that even when thin pack compatibility is activated,it will not be turned on for the domain dev.azure.com.
--git-clone-submodulesENVBUILDER_GIT_CLONE_SUBMODULESClone Git submodules after cloning the repository. Accepts 'true' (max depth 10), 'false' (disabled), or a non-negative integer for max recursion depth (0 disables, max 100).
--git-usernameENVBUILDER_GIT_USERNAMEThe username to use for Git authentication. This is optional.
--git-passwordENVBUILDER_GIT_PASSWORDThe password to use for Git authentication. This is optional.
--git-ssh-private-key-pathENVBUILDER_GIT_SSH_PRIVATE_KEY_PATHPath to an SSH private key to be used for Git authentication. If this is set, then GIT_SSH_PRIVATE_KEY_BASE64 cannot be set.
--git-ssh-private-key-base64ENVBUILDER_GIT_SSH_PRIVATE_KEY_BASE64Base64 encoded SSH private key to be used for Git authentication. If this is set, then GIT_SSH_PRIVATE_KEY_PATH cannot be set.
--git-http-proxy-urlENVBUILDER_GIT_HTTP_PROXY_URLThe URL for the HTTP proxy. This is optional.
--workspace-base-dirENVBUILDER_WORKSPACE_BASE_DIR/workspacesThe path under which workspaces will be placed when workspace folder option is not given.
--workspace-folderENVBUILDER_WORKSPACE_FOLDERThe path to the workspace folder that will be built. This is optional. Defaults to [workspace base dir]/[name] where name is the name of the repository or empty.
--ssl-cert-base64ENVBUILDER_SSL_CERT_BASE64The content of an SSL cert file. This is useful for self-signed certificates.
--export-env-fileENVBUILDER_EXPORT_ENV_FILEOptional file path to a .env file where envbuilder will dump environment variables from devcontainer.json and the built container image.
--post-start-script-pathENVBUILDER_POST_START_SCRIPT_PATHThe path to a script that will be created by envbuilder based on the postStartCommand in devcontainer.json, if any is specified (otherwise the script is not created). If this is set, the specified InitCommand should check for the presence of this script and execute it after successful startup.
--coder-agent-urlCODER_AGENT_URLURL of the Coder deployment. If CODER_AGENT_TOKEN is also set, logs from envbuilder will be forwarded here and will be visible in the workspace build logs.
--coder-agent-tokenCODER_AGENT_TOKENAuthentication token for a Coder agent. If this is set, then CODER_AGENT_URL must also be set.
--coder-agent-subsystemCODER_AGENT_SUBSYSTEMCoder agent subsystems to report when forwarding logs. The envbuilder subsystem is always included.
--push-imageENVBUILDER_PUSH_IMAGEPush the built image to a remote registry. This option forces a reproducible build.
--get-cached-imageENVBUILDER_GET_CACHED_IMAGEPrint the digest of the cached image, if available. Exits with an error if not found.
--remote-repo-build-modeENVBUILDER_REMOTE_REPO_BUILD_MODEfalseUse the remote repository as the source of truth when building the image. Enabling this option ignores user changes to local files and they will not be reflected in the image. This can be used to improving cache utilization when multiple users are building working on the same repository.
--verboseENVBUILDER_VERBOSEEnable verbose logging.