Skip to content

Commit 4b40aac

Browse files
authored
Merge pull request #8004 from ucheNkadiCode/projectNameEdits
Compose property additions
2 parents f6ef2e3 + b6de1e4 commit 4b40aac

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

docs/containers/docker-compose-properties.md

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ author: ghogen
44
description: Learn how to edit the Docker Compose build properties to customize how Visual Studio builds and runs a Docker Compose application.
55
ms.custom: SEO-VS-2020
66
ms.author: ghogen
7-
ms.date: 08/12/2019
7+
ms.date: 04/06/2021
88
ms.technology: vs-azure
99
ms.topic: reference
1010
---
@@ -37,7 +37,7 @@ The following table shows the MSBuild properties available for Docker Compose pr
3737
|DockerComposeProjectName| dcproj | If specified, overrides the project name for a docker-compose project. | "dockercompose" + auto-generated hash |
3838
|DockerComposeProjectPath|csproj or vbproj|The relative path to the docker-compose project (dcproj) file. Set this property when publishing the service project to find the associated image build settings stored in the docker-compose.yml file.|-|
3939
|DockerComposeUpArguments|dcproj|Specifies the extra parameters to pass to the `docker-compose up` command. For example, `--timeout 500`|-|
40-
|DockerDevelopmentMode|dcproj| Controls whether "build-on-host" optimization ("Fast Mode" debugging) is enabled. Allowed values are **Fast** and **Regular**. | Fast |
40+
|DockerDevelopmentMode|dcproj| Controls whether "build-on-host" optimization ("Fast Mode" debugging) is enabled. Allowed values are `Fast` and `Regular`. | `Fast` in the Debug configuration or `Regular` in all other configurations |
4141
|DockerLaunchAction| dcproj | Specifies the launch action to perform on F5 or Ctrl+F5. Allowed values are None, LaunchBrowser, and LaunchWCFTestClient.|None|
4242
|DockerLaunchBrowser| dcproj | Indicates whether to launch the browser. Ignored if DockerLaunchAction is specified. | False |
4343
|DockerServiceName| dcproj|If DockerLaunchAction or DockerLaunchBrowser are specified, then DockerServiceName is the name of the service that should be launched. Use this property to determine which of the potentially many projects that a docker-compose file can reference will be launched.|-|
@@ -87,9 +87,16 @@ services:
8787
> [!NOTE]
8888
> DockerComposeBuildArguments, DockerComposeDownArguments, and DockerComposeUpArguments are new in Visual Studio 2019 version 16.3.
8989
90-
## Docker Compose file labels
90+
## Overriding Visual Studio's Docker Compose configuration
9191
92-
You can also override certain settings by placing a file named *docker-compose.vs.debug.yml* (for **Debug** configuration) or *docker-compose.vs.release.yml* (for **Release** configuration) in the same directory as your *docker-compose.yml* file. In this file, you can specify settings as follows:
92+
You can override certain settings by placing a file named *docker-compose.vs.debug.yml* (for **Fast** mode) or *docker-compose.vs.release.yml* (for **Regular** mode) in the same directory as your *docker-compose.yml* file.
93+
94+
>[!TIP]
95+
>To find out the default values for any of these settings, look in *docker-compose.vs.debug.g.yml* or *docker-compose.vs.release.g.yml*.
96+
97+
### Docker Compose file labels
98+
99+
In *docker-compose.vs.debug.yml* or *docker-compose.vs.release.yml*, you can define override-specific labels as follows:
93100
94101
```yml
95102
services:
@@ -103,23 +110,34 @@ Use double quotes around the values, as in the preceding example, and use the ba
103110
|Label name|Description|
104111
|----------|-----------|
105112
|com.microsoft.visualstudio.debuggee.arguments|The arguments passed to the program when starting debugging. For .NET Core apps, these arguments are typically additional search paths for NuGet packages followed by the path to the project's output assembly.|
106-
|com.microsoft.visualstudio.debuggee.killprogram|This command is used to stop the debuggee program that's running inside of the container (when necessary).|
107113
|com.microsoft.visualstudio.debuggee.program|The program launched when starting debugging. For .NET Core apps, this setting is typically **dotnet**.|
108114
|com.microsoft.visualstudio.debuggee.workingdirectory|The directory used as the starting directory when starting debugging. This setting is typically */app* for Linux containers, or *C:\app* for Windows containers.|
115+
|com.microsoft.visualstudio.debuggee.killprogram|This command is used to stop the debuggee program that's running inside of the container (when necessary).|
109116
110-
## Customize the app startup process
117+
### Customize the Docker build process
111118
112-
You can run a command or custom script before launching your app by using the `entrypoint` setting, and making it dependent on the configuration. For example, if you need to set up a certificate only in **Debug** mode by running `update-ca-certificates`, but not in **Release** mode, you could add the following code only in *docker-compose.vs.debug.yml*:
119+
You can declare which stage to build in your Dockerfile by using the `target` setting in the `build` property. This override can be used in only the *docker-compose.vs.debug.yml* or *docker-compose.vs.release.yml*
113120

114121
```yml
115122
services:
116123
webapplication1:
117-
entrypoint: "sh -c 'update-ca-certificates && tail -f /dev/null'"
124+
build:
125+
target: customStage
118126
labels:
119127
...
120128
```
121129

122-
If you omit the *docker-compose.vs.release.yml* or *docker-compose.vs.debug.yml* then Visual Studio generates one based on default settings.
130+
### Customize the app startup process
131+
132+
You can run a command or custom script before launching your app by using the `entrypoint` setting, and making it dependent on the `DockerDevelopmentMode`. For example, if you need to set up a certificate only in **Fast** mode by running `update-ca-certificates`, but not in **Regular** mode, you could add the following code in **only** *docker-compose.vs.debug.yml*:
133+
134+
```yml
135+
services:
136+
webapplication1:
137+
entrypoint: "sh -c 'update-ca-certificates && tail -f /dev/null'"
138+
labels:
139+
...
140+
```
123141

124142
## Next steps
125143

0 commit comments

Comments
 (0)