白羊座的幸运色是什么颜色| 印度为什么用手吃饭| 六月什么星座| 一流是什么意思| 杰字属于五行属什么| 低gi什么意思| 胸部彩超能检查出什么| 什么是胰腺| 丑未戌三刑会发生什么| 旁风草长什么样| 正连级相当于地方什么级别| 父亲节出什么生肖| 晚上睡觉脚冰凉是什么原因| 槐子泡水喝有什么功效| 鼻子出汗多是什么原因| 炎症是什么原因引起的| 下巴底下长痘痘是什么原因| 怕金病帕金森是什么症状| 太安鱼是什么鱼| 爱情的故事分分合合是什么歌| 睡眠不好总做梦是什么原因| 容易口腔溃疡什么原因| 酸化是什么意思| 1998年出生属什么| 兰蔻适合什么年龄的人用| b2是什么| 重丧是什么意思| 大便有凹槽是什么原因| lc是什么意思| 梦到和老公吵架是什么意思| 荨麻疹能吃什么食物| 玉米除草剂什么时候打最好| 霸王别姬是什么菜| 什么是民间故事| gm墨镜是什么牌子| 观音菩萨成道日是什么意思| 中药液是什么药| 肝火旺盛是什么原因引起的| 611是什么意思| 起床眼睛肿是什么原因| 不加热血清反应素试验是什么| 化学性肝损伤是什么意思| 梨形心见于什么病| 确幸是什么意思| 蝙蝠长什么样| 属牛的生什么属相的孩子好| 老班章是什么茶| 潘粤明老婆现任叫什么| 乳糖不耐受吃什么奶粉| 人格是什么意思| 晚上猫叫有什么预兆| 吐舌头是什么意思| 消融术是什么手术| 车顶放饮料什么意思| 提供什么| 大脑记忆力下降是什么原因| 8月1号是什么星座| 脚心热吃什么药| 吃甘草片有什么副作用| 两败俱伤是什么意思| 戊土是什么土| 乙肝是什么病严重吗| 心慌是什么感觉| 宫颈炎用什么药| 清肺吃什么好| 脚踝韧带拉伤吃什么| 葳是什么意思| 细胞核由什么组成| 耳朵听不清楚是什么原因| 鼻子和嘴巴连接的地方叫什么| 猪肉炒什么好吃| 甲状腺球蛋白低是什么意思| 养鱼为什么养单不养双| 一月底是什么星座| 碳酸氢钠是什么| 蕊字五行属什么| 不字五行属什么| 等闲识得东风面什么意思| 冲蛇煞西是什么意思| 明虾是什么虾| 胃病四联疗法是什么药| 50公斤发什么物流便宜| 什么泡水喝降甘油三酯| 什么网站可以看三节片| 5月12日是什么星座| 脑瘫是什么症状| 水柔棉是什么面料| 什么的鸟窝| 不发烧流鼻涕打喷嚏吃什么药| 肠镜前一天可以吃什么| 肝胆不好有什么症状有哪些表现| 何其是什么意思| 大姨妈来的少是什么原因| 大卡是什么意思| 减肥去医院挂什么科| 素女经是什么| 五劳七伤指的是什么| 带状疱疹是什么原因引起| 股票套牢是什么意思| tory burch什么牌子| 六月九号什么星座| 豆角和什么不能一起吃| 清心寡欲什么意思| 慢工出细活什么意思| 平方是什么意思| 经血粉红色是什么原因| ahc是韩国什么档次| 宫颈醋酸白色上皮是什么病变| 喝什么水对身体好| 晚上睡不着是什么原因| 胃不好不能吃什么| 红枣什么时候吃最好| 4月16日什么星座| 菩提是什么| 血液净化是什么意思| 嘴唇上火起泡是什么原因| 吉祥如意是什么意思| 属相是什么意思| 脚气吃什么维生素| 常山现在叫什么| 篦子是什么东西| 为什么被蚊子咬了会起包| 什么是自由度| 什么是寓言故事| 狮子头是什么肉| 秤砣是什么意思| 2028年属什么生肖| 龙胆泻肝丸治什么病| 肉碱是什么| 肝囊肿饮食要注意什么| 出山是什么意思| 靓女是什么意思| 湿气重怎么调理吃什么| 唐僧属什么生肖| 眉毛尾部有痣代表什么| ur是什么品牌| 北京西单附近有什么好玩的| 良心是什么意思| 香港为什么叫香港| 胡歌真名叫什么| 惊蛰是什么意思| 放疗为什么死得更快| 千斤拔泡酒有什么功效| 儿童抗o高会引起什么病| 空挡是什么意思| kimi什么意思| 蚕豆有什么营养| 血液为什么是红色| 包皮开裂擦什么药膏| 车厘子是什么季节的| 男生学什么技术吃香| 洺字五行属什么| 视网膜病变是什么意思| 肛门瘙痒是什么原因| 喝什么| 东南大学什么专业最牛| 本科是什么| 蜱虫最怕什么药| 脱肛是什么原因造成的| 耳语是什么意思| 闺六月是什么意思| 为什么会心悸| 小腿肚酸胀是什么原因| 男人胸前有痣代表什么意思| 什么是病原体| 为什么胸部会胀痛| 肾不好吃什么好| 为什么受伤总是我| 将军是什么级别| 陈皮的功效是什么| 什么的温度| 红薯什么时候种植| funfair是什么意思| 湿热吃什么药好| 磨玻璃影是什么意思| 荟字五行属什么| 怀不上孕做什么检查| 阳历8月份是什么星座| 右小腿抽筋是什么原因| 病毒为什么会变异| 7月25号是什么星座| 舌系带长有什么影响吗| gender什么意思| 腹胀屁多是什么原因| 偏旁部首是什么意思| 低密度脂蛋白高是什么意思| tb是什么| 早上起床手指肿胀是什么原因| 斗牛为什么用红色的布| 胃溃疡可以吃什么水果| 簋是什么| 孕妇脚肿是什么原因| 奥美拉唑是什么药| 排骨炖山药有什么功效| 纷至沓来什么意思| 肾积水挂什么科室| tfcc是什么| 霸是什么生肖| 酸菜鱼里面加什么配菜好吃| 中医为什么不让睡凉席| 十二指肠溃疡是什么症状| 口臭口苦什么原因引起的| 阳贵是什么意思| 凯子和马子是什么意思| 独一味是什么药| 02年的属什么| 棕色用什么颜色调出来| 韩信点兵什么意思| 眼睛老是流眼泪是什么原因| 7月17日是什么日子| 一年半载是什么意思| 儿童过敏吃什么药| 人工授精是什么意思| 小叶增生吃什么药| 为什么会突然得荨麻疹| 联系是什么意思| 豇豆是什么| 绝经三年了突然又出血了什么原因| 柳树代表什么生肖| 口腔炎吃什么药| 肺结节看什么科| 怨念是什么意思| 讳莫如深是什么意思| 视力模糊是什么原因| 金针菇不能和什么一起吃| 安踏高端品牌叫什么| 皮肤痒有什么特效药| 白羊女跟什么星座最配| 什么是稽留流产| 我们在干什么| 久之的之是什么意思| 女生纹身什么图案好看| 半夜三更是什么生肖| 混剪是什么意思| 曼月乐是什么| 右手手指头麻木是什么病的前兆| 梦到发洪水是什么征兆| 婴儿枕头里面装什么好| 香菜不能和什么一起吃| 高冷是什么意思| 三堂会审是什么意思| 男性生殖器叫什么| 神奇的近义词是什么| 乳腺无回声结节是什么意思| 乱点鸳鸯谱什么意思| 猥琐是什么意思| 胃肠感冒什么症状| 蝴蝶是什么变的| 腰椎间盘突出看什么科| 仓鼠可以吃什么| 运动有什么好处| s和m是什么| hsv病毒是什么意思| 一心一意是什么生肖| 梦见订婚是什么意思| 晚上睡觉尿多是什么原因| 小孩头疼是什么原因| 经常嗳气是什么原因| 嘴唇发白什么原因| 红细胞偏低是什么意思| 脸上长闭口是什么原因导致的| 破财消灾什么意思| 甲钴胺片主要治什么病| 啮齿是什么意思| 百度

Try to extend agent mode in VS Code!

售价惊人!诺基亚宣布三款新机:骁龙835旗舰来了

百度   飞机离最近的旧金山也有两个小时的路程,在降落旧金山之前,吴小波将患者身体放平,给他盖上了衣服保持体温,并将飞机上的简易氧气筒拿来对患者进行吸氧治疗。

The Container Tools extension includes several Visual Studio Code tasks to control the behavior of Docker build and run, and form the basis of container startup for debugging.

The tasks allow for a great deal of control and customization. The final configuration is a combination of general defaults, platform-specific defaults (such as Node.js, Python, or .NET), and user input. User input takes precedence when it conflicts with defaults.

All common features of Visual Studio Code tasks (for example, grouping tasks into compound tasks) are supported by Container Tools extension tasks. For more information on common task features and properties, see the Visual Studio Code custom task documentation.

Docker build task

The docker-build task builds images using the Docker command line (CLI). The task can be used by itself, or as part of a chain of tasks to run and/or debug an application within a container.

The most important configuration settings for the docker-build task are dockerBuild and platform:

  • The dockerBuild object specifies parameters for the Docker build command. Values specified by this object are applied directly to Docker build CLI invocation.
  • The platform property is a hint that changes how the docker-build task determines Docker build defaults.

See property reference for full list of all task properties.

Platform support

While the docker-build task in tasks.json can be used to build any image, the extension has explicit support (and simplified configuration) for Node.js, Python, and .NET Core.

Node.js (docker-build)

Minimal configuration using defaults

A Node.js-based image with no specific platform options can just set the platform property to node:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Build Node Image",
      "type": "docker-build",
      "platform": "node"
    }
  ]
}

Platform defaults

For Node.js-based images, the docker-build task infers the following options:

Property Inferred Value
dockerBuild.context The same directory in which the package.json resides.
dockerBuild.dockerfile The file Dockerfile in the same directory as the package.json resides.
dockerBuild.tag The application's name property in package.json (if defined), else the base name of the folder in which package.json resides.
dockerBuild.pull Defaults to true in order to pull new base images before building.

Python (docker-build)

Minimal configuration using defaults

A Python-based image with no specific platform options can just set the platform property to python:

{
  "tasks": [
    {
      "type": "docker-build",
      "label": "docker-build",
      "platform": "python"
    }
  ]
}

Platform defaults

For Python-based images, the docker-build task infers the following options:

Property Inferred Value
dockerBuild.context The default context is the workspace folder.
dockerBuild.dockerfile The default Dockerfile path will be in the root of the workspace folder.
dockerBuild.tag The base name of the root workspace folder.
dockerBuild.pull Defaults to true in order to pull new base images before building.

.NET (docker-build)

Minimal configuration using defaults

When you build a .NET-based image, you can omit the platform property and just set the netCore object (platform is implicitly set to netcore when netCore object is present). Note that appProject is a required property:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Build Node Image",
      "type": "docker-build",
      "netCore": {
        "appProject": "${workspaceFolder}/project.csproj"
      }
    }
  ]
}

Platform defaults

For .NET-based images, the docker-build task infers the following options:

Property Inferred Value
dockerBuild.context The root workspace folder.
dockerBuild.dockerfile The file Dockerfile in the root workspace folder.
dockerBuild.tag The base name of the root workspace folder.
dockerBuild.pull Defaults to true in order to pull new base images before building.

Build task reference

Here are all properties available for configuring docker-build task. All properties are optional unless indicated otherwise.

Property Description
dockerBuild Options for controlling the docker build command executed (see below).
Required unless platform is set.
platform Determines the platform: .NET (netcore) or Node.js (node) and default settings for docker build command.
node Determines options specific for Node.js projects (see below).
python There are no object properties for Python in the docker-build task.
netCore Determines options specific for .NET projects (see below).

dockerBuild object properties

Property Description docker build CLI Equivalent
context The path to the build context.
Required, unless inferred from the platform.
PATH
dockerfile The path to the Dockerfile.
Required, unless inferred from the platform.
-f or --file
tag The tag applied to the image.
Required, unless inferred from the platform.
-t or --tag
buildArgs Build arguments applied to the command line. This is a list of key-value pairs. --build-arg
labels Labels added to the image. This is a list of key-value pairs (a JSON object).
In addition to labels specified here, a label com.microsoft.created-by, set to visual-studio-code is added to the image. This behavior can be turned off by setting includeDefaults property of the labels object to false.
--label
target The target in the Dockerfile to build to. --target
pull Whether or not to pull new base images before building. --pull
customOptions Any extra parameters to add before the context argument. No attempt is made to resolve conflicts with other options or validate this option. (any)

node object properties (docker-build task)

Property Description Default
package The path to the package.json file associated with the Dockerfile and docker-build task. The file package.json in the root workspace folder.

netCore object properties (docker-build task)

Property Description
appProject The .NET project file (.csproj, .fsproj, etc.) associated with the Dockerfile and docker-build task.
Required always.

Docker run task

The docker-run task in tasks.json creates and starts a container using the Docker command line (CLI). The task can be used by itself, or as part of a chain of tasks to debug an application within a container.

The most important configuration settings for the docker-run task are dockerRun and platform:

  • The dockerRun object specifies parameters for the Docker run command. Values specified by this object are applied directly to Docker run CLI invocation.
  • The platform property is a hint that changes how the docker-run task determines Docker run defaults.

See property reference for full list of all task properties.

Docker run platform support

While the docker-run task can be used to run any Docker image, the extension has explicit support (and simplified configuration) for Node.js, Python, and .NET.

Node.js (docker-run)

Minimal configuration using defaults

A Node.js-based image with no specific platform options can just set the platform property to node.

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Run Node Image",
      "node": "docker-run",
      "platform": "node"
    }
  ]
}

Platform defaults

For Node.js-based images, the docker-run task infers the following options:

Property Inferred Value
dockerRun.command Generated from the npm start script in the package.json (if it exists), else generated from the main property in the package.json.
dockerRun.containerName Derived from the application package name.
dockerRun.image The tag from a dependent docker-build task (if one exists) or derived from the application package name, itself derived from the name property within package.json or the base name of the folder in which it resides.

Python (docker-run)

When building a Python-based image, you can omit the platform property and just set the python object (platform is implicitly set to python when python object is present)

Minimal configuration for Django Apps

{
  "type": "docker-run",
  "label": "docker-run: debug",
  "dependsOn": ["docker-build"],
  "python": {
    "args": ["runserver", "0.0.0.0:8000", "--nothreading", "--noreload"],
    "file": "path_to/manage.py"
  }
}

Minimal configuration for Flask Apps

{
  "type": "docker-run",
  "label": "docker-run: debug",
  "dependsOn": ["docker-build"],
  "dockerRun": {
    "env": {
      "FLASK_APP": "path_to/flask_entry_point.py"
    }
  },
  "python": {
    "args": ["run", "--no-debugger", "--no-reload", "--host", "0.0.0.0", "--port", "5000"],
    "module": "flask"
  }
}

Minimal configuration for General Apps

{
  "type": "docker-run",
  "label": "docker-run: debug",
  "dependsOn": ["docker-build"],
  "python": {
    "file": "path_to/app_entry_point.py"
  }
}

Platform defaults

For Python-based images, the docker-run task infers the following options:

Property Inferred Value
dockerRun.command Generated by the Python object and is called by the Python Debugger.
dockerRun.containerName Derived from the base name of the root workspace folder.
dockerRun.image The tag from a dependent docker-build task (if one exists) or derived from the base name of the root workspace folder.

.NET (docker-run)

Minimal configuration using defaults

When building a .NET-based image, you can omit the platform property and just set the netCore object (platform is implicitly set to netcore when netCore object is present). Note that appProject is a required property:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Run .NET Core Image",
      "type": "docker-run",
      "netCore": {
        "appProject": "${workspaceFolder}/project.csproj"
      }
    }
  ]
}

Platform defaults

For .NET-based images, the docker-run task infers the following options:

Property Inferred Value
dockerRun.containerName Derived from the base name of the root workspace folder.
dockerRun.env Adds the following environment variables as required: ASPNETCORE_ENVIRONMENT, ASPNETCORE_URLS, and DOTNET_USE_POLLING_FILE_WATCHER.
dockerRun.image The tag from a dependent docker-build task (if one exists) or derived from the base name of the root workspace folder.
dockerRun.os Linux
dockerRun.volumes Adds the following volumes as required: the local application folder, the source folder, the debugger folder, the NuGet package folder, and NuGet fallback folder.

Run task reference

Here are all properties available for configuring docker-run task. All properties are optional unless indicated otherwise.

Property Description
dockerRun Options for controlling the docker run command executed (see below).
Required unless platform is set.
platform Determines the platform: .NET (netcore) or Node.js (node) and default settings for docker run command.
node For Node.js projects, this controls various options (see below).
python For Python projects, this controls various options (see below).
netCore For .NET projects, this controls various options (see below).

dockerRun object properties

Property Description CLI Equivalent
image The name (tag) of the image to run.
Required unless inferred from the platform.
IMAGE
command The command to run upon starting the container.
Required, unless inferred from the platform.
COMMAND [ARG...]
containerName The name given to the started container.
Required, unless inferred from the platform.
--name
env Environment variables set in the container. This is a list of key-value pairs. -e or --env
envFiles This is a list of .env files. --env-file
labels Labels given to the started container. This is a list of key-value pairs. --label
network The name of the network to which the container will be connected. --network
networkAlias The network-scoped alias for the started container. --network-alias
os Default is Linux, the other option is Windows. The container operating system used. N/A
ports The ports to publish (map) from container to host. This is a list of objects (see below). -p or --publish
portsPublishAll Whether to publish all ports exposed by the Docker image. Defaults to true if no ports are explicitly published. -P
extraHosts The hosts to add to the container for DNS resolution. This is a list of objects (see below). --add-host
volumes The volumes to map into the started container. This is a list of objects (see below). -v or --volume
remove Whether or not to remove the container after it stops. --rm
customOptions Any extra parameters to add before the image argument. No attempt is made to resolve conflicts with other options or validate this option. (any)

ports object properties

Property Description Default
containerPort The port number bound on the container.
Required.
hostPort The port number bound on the host. (randomly selected by Docker)
protocol The protocol for the binding (tcp or udp). tcp

extraHosts object properties

Property Description
hostname The hostname for DNS resolution.
Required.
ip The IP address associated with the above hostname.
Required.

volumes object properties

Property Description Default
localPath The path on the local machine that will be mapped.
Required.
containerPath The path in the container to which the local path will be mapped.
Required.
permissions Permissions the container has on the mapped path. Can be ro (read-only) or rw (read-write). Container dependent.

node object properties (docker-run task)

Property Description Default
package The path to the package.json file associated with the docker-run task. The file package.json in the root workspace folder.
enableDebugging Whether or not to enable debugging within the container. false
inspectMode Defines the initial interaction between the application and the debugger (default or break).
The value default allows the application to run until the debugger attaches.
The value break prevents the application from running until the debugger attaches.
default
inspectPort The port on which debugging should occur. 9229

python object properties (docker-run task)

Property Description Default
args Arguments passed to the Python app. Platform dependent. Defaults of scaffolding shown above
debugPort The port that the debugger will listen on. 5678
wait Whether to wait for debugger to attach. true
module The Python module to run (only module or file should be chosen).
file The Python file to run (only module or file should be chosen).

netCore object properties (docker-run task)

Property Description
appProject The .NET project file (.csproj, .fsproj, etc.) associated with docker-run task.
Required.
configureSsl Whether to configure ASP.NET Core SSL certificates and other settings to enable SSL on the service in the container.
enableDebugging Whether to enable the started container for debugging. This will infer additional volume mappings and other options necessary for debugging.

Docker Compose task

The docker-compose task in tasks.json creates and starts containers using the Docker Compose command line (CLI). The task can be used by itself, or as part of a chain of tasks to debug an application within a container.

The most important configuration setting for the docker-compose task is dockerCompose:

  • The dockerCompose object specifies parameters for the Docker Compose command. Values specified by this object are applied directly to Docker Compose CLI invocation.

See property reference for full list of all task properties.

Example configuration

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Run docker-compose up",
      "type": "docker-compose",
      "dockerCompose": {
        "up": {
          "detached": true,
          "build": true,
          "services": ["myservice"]
        },
        "files": [
          "${workspaceFolder}/docker-compose.yml",
          "${workspaceFolder}/docker-compose.debug.yml"
        ]
      }
    }
  ]
}

Compose task reference

Here are all properties available for configuring docker-compose task. All properties are optional unless indicated otherwise.

Property Description
dockerCompose Options for controlling the docker-compose command executed (see below).
Required.

dockerCompose object properties

Property Description CLI Equivalent
up Run a docker-compose up command.
Either this or down must be specified, but not both.
docker-compose up
down Run a docker-compose down command.
Either this or up must be specified, but not both.
docker-compose down
files The list of Docker Compose YAML files to use in the docker-compose command. If not specified, the Docker Compose CLI looks for docker-compose.yml and docker-compose.override.yml. -f <file>
envFile File of environment variables read in and applied to the containers. --env-file <file>
projectName Alternate project name to use when naming and labeling Docker objects. If using an alternate project name when composing up, the same project name must be specified when composing down. --project-name <name>

up object properties

Property Description CLI Equivalent Default
detached Whether or not to run detached. -d true
build Whether or not to build before running. --build true
scale Number of instances of each service to run. This is a list of key-value pairs. --scale SERVICE=NUM
services A subset of the services to start. Cannot be combined with profiles. [SERVICE...] (all)
profiles A subset of the profiles to start. Cannot be combined with services. --profile <profile> (all)
customOptions Any extra parameters to add after the up argument. No attempt is made to resolve conflicts with other options or validate this option. (any)

down object properties

Property Description CLI Equivalent Default
removeImages Whether to remove images, and which. all will remove all images used by any service, local will remove only images without a custom tag. Leaving this unset will remove no images. --rmi
removeVolumes Whether or not to remove named volumes. -v false
customOptions Any extra parameters to add after the down argument. No attempt is made to resolve conflicts with other options or validate this option. (any)

Command customization

The Container Tools extension executes a number of Docker CLI commands when you perform various operations, such as to build images, run containers, attach to containers, and view container logs. Some of these commands have a large number of optional arguments, often used in very specific scenarios. As an alternative to the above Visual Studio Code tasks, several commands can be customized when tasks are not in use.

For example, the tokens ${serviceList} and ${profileList} in the Compose Up command allows for easily starting a subset of the services within your Docker Compose YAML file(s).

For each of these customizable Docker commands, a configuration setting is available to set the template of what to execute. Alternatively, you can define multiple templates, optionally with a regular expression, which when matched, hints the context in which a template should be used. The templates support some tokens similar to launch.json and tasks.json, for example, ${workspaceFolder}.

Settings JSON schema

You have two options for configuring each of the templates (listed below). The first option is a single template that overrides the default behavior:

{
  "containers.commands.build": "docker build --rm -f \"${dockerfile}\" -t ${tag} \"${context}\""
}

The second option is multiple templates that will be chosen based on the match regular expression, as well as user input.

For example, three templates are shown in the following example:

{
  "containers.commands.build": [
    {
      "label": "Default build command",
      "template": "docker build --rm -f \"${dockerfile}\" -t ${tag} \"${context}\""
    },
    {
      "label": "Alpine-specific build command",
      "template": "docker build -p 1234:1234 -f \"${dockerfile}\" -t ${tag} \"${context}\"",
      "match": "alpine"
    }
  ]
}

Selection behavior

The command template chosen to execute is selected based on the following rules:

  1. If no setting is configured, the default command template is chosen.
  2. If only a single template is configured (the first example above), that template is chosen.
  3. If multiple templates are configured:
    1. Constrained templates are checked. A constrained template has match. The match regular expression is compared against contextual hints--for example, image name, container name, etc.
    2. If multiple constrained templates apply, the user will be prompted to choose. If only one applies, the user will not be prompted.
    3. If there no applicable constrained templates, unconstrained templates are checked. An unconstrained template does not have match, and is therefore always applicable.
    4. If multiple unconstrained templates apply, the user will be prompted to choose. If only one applies, the user will not be prompted.

Docker Build

Configuration Setting Default Value
docker.commands.build ${containerCommand} build --rm -f "${dockerfile}" -t ${tag} "${context}"

Supported tokens:

Token Description
${containerCommand} The CLI command / executable used to execute container commands.
${dockerfile} The workspace-relative path of the selected Dockerfile.
${tag} The value entered/confirmed by the user upon invoking the build command. If previously built, defaults to the previously entered value for that Dockerfile.
${context} If set, the value of the containers.imageBuildContextPath configuration setting. Otherwise, the workspace-relative folder in which the Dockerfile resides.

Note: If the containers.commands.build setting does not contain the ${tag} token, the user will not be prompted to enter/confirm a tag.

Note: The match regular expression will be compared against the selected Dockerfile name and the workspace folder name.

Docker Run

Configuration Setting Default Value
containers.commands.run ${containerCommand} run --rm -d ${exposedPorts} ${tag}
containers.commands.runInteractive ${containerCommand} run --rm -it ${exposedPorts} ${tag}

Supported tokens:

Token Description
${containerCommand} The CLI command / executable used to execute container commands.
${exposedPorts} Generated from the list of exposed ports in the image (ultimately from the Dockerfile), where each exposed port is mapped to the same port on the local machine. For example, "EXPOSE 5000 5001" would generate "-p 5000:5000 -p 5001:5001".
${tag} The full tag of the selected image.

Note: The match regular expression will be compared against the full tag of the selected image.

Container Attach

Configuration Setting Default Value
containers.commands.attach ${containerCommand} exec -it ${containerId} ${shellCommand}

Supported tokens:

Token Description
${containerCommand} The CLI command / executable used to execute container commands.
${containerId} The ID of the container to attach to.
${shellCommand} If bash is present in the container, it is substituted here, otherwise sh. In Windows containers, cmd is always used.

Note: The match regular expression will be compared against the container name and full tag of the container image.

Container Logs

Configuration Setting Default Value
containers.commands.logs ${containerCommand} logs -f ${containerId}

Supported tokens:

Token Description
${containerCommand} The CLI command / executable used to execute container commands.
${containerId} The ID of the container to view the logs for.

Note: The match regular expression will be compared against the container name and full tag of the container image.

Docker Compose Up

Configuration Setting Default Value
containers.commands.composeUp ${composeCommand} ${configurationFile} up ${detached} ${build}

Supported tokens:

Token Description
${configurationFile} Set to -f plus the workspace-relative path to the selected Docker Compose YAML file.
${detached} Set to -d if the configuration setting containers.composeDetached is set to true. Otherwise, set to "".
${build} Set to --build if the configuration setting containers.composeBuild is set to true. Otherwise, set to "".
${serviceList} If specified, prompts for a subset of the services to start when the command is run.
${profileList} If specified and the Docker Compose YAML file contains profiles, prompts for a subset of the profiles to start when the command is run.
${composeCommand} Set to the value of the containers.composeCommand setting if set, otherwise the extension will try to automatically determine the command to use (docker compose or docker-compose).

Docker Compose Down

Configuration Setting Default Value
containers.commands.composeDown ${composeCommand} ${configurationFile} down

Supported tokens:

Token Description
${configurationFile} Set to -f plus the workspace-relative path to the selected Docker Compose YAML file.
${composeCommand} Set to the value of the containers.composeCommand setting if set, otherwise the extension will try to automatically determine the command to use (docker compose or docker-compose).

Additional supported tokens

In addition to the command-specific supported tokens, the following tokens are supported in all command templates:

Token Description
${workspaceFolder} The selected workspace folder path.
${config:some.setting.identifier} The value of any configuration setting, as long as it is a string, number, or boolean. These setting identifiers can be arbitrarily defined and do not need to belong to Visual Studio Code or to any extension.
${env:Name} The value of an environment variable.
${command:commandID} The string return value of a command.
吃什么奶水会增多 亲子鉴定去医院挂什么科 理想主义者是什么意思 雄性激素是什么 轻度郁症有什么表现
猪蛋是什么 三尖瓣反流什么意思 胸口隐隐作痛挂什么科 肝囊肿是什么 99年属什么生肖
腿肿脚肿是什么病的前兆 一什么泪珠 情感障碍是什么 怀孕了吃什么药能流掉 河虾吃什么食物
饱和脂肪是什么 吃什么醒酒 夏至吃什么 肝ca什么意思 菊花什么时候开花
武则天是什么朝代hcv9jop4ns9r.cn 胃溃疡可以吃什么水果hcv9jop3ns8r.cn 文笔是什么意思hcv8jop5ns8r.cn 受害者是什么意思xinjiangjialails.com 麻黄是什么hcv8jop6ns7r.cn
白带是什么意思hcv9jop1ns2r.cn 盘古是一个什么样的人hcv9jop0ns0r.cn ein是什么牌子hcv8jop4ns3r.cn 相对密度是什么意思hcv9jop0ns7r.cn 儿童贫血吃什么补血最快hcv9jop8ns1r.cn
山楂泡酒有什么功效hcv9jop1ns6r.cn 血细胞分析五分类是查什么的hcv8jop4ns7r.cn 黑卡是什么卡hcv8jop4ns4r.cn lol锤石什么时候出的hcv8jop5ns5r.cn 吸入甲醛会有什么症状hcv8jop8ns5r.cn
为什么乳晕会变大hcv7jop9ns8r.cn rt是什么单位hcv7jop9ns6r.cn 潮宏基是什么档次的baiqunet.com 膳食纤维有什么作用fenrenren.com 安徽属于什么地区hcv9jop0ns0r.cn
百度