You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Learn about the launch settings for Container Tools that are related to how Visual Studio handles containerized apps.
5
5
ms.author: ghogen
6
-
ms.date: 08/15/2019
6
+
ms.date: 10/7/2024
7
7
ms.subservice: container-tools
8
8
ms.topic: reference
9
9
---
@@ -12,7 +12,11 @@ ms.topic: reference
12
12
13
13
In the *Properties* folder in an ASP.NET Core project, you can find the `launchSettings.json` file, which contains settings that control how your web app is started on your development machine. For detailed information on how this file is used in ASP.NET development, see [Use multiple environments in ASP.NET Core](/aspnet/core/fundamentals/environments?view=aspnetcore-2.2&preserve-view=true).
14
14
15
-
You can edit this file directly, but in Visual Studio IDE, you can also edit the properties in this file through the UI. Choose the dropdown list next to the launch option (for example, `Docker` or `.NET SDK`), and then choose **Debug Properties**.
15
+
You can edit this file directly, but in Visual Studio IDE, you can also edit the properties in this file through the UI. Choose the dropdown list next to the launch option (for example, `Docker` or `.NET SDK`), and then choose **Debug Properties** for a single-container project.
16
+
17
+

18
+
19
+
For Docker Compose, choose **Manage Docker Compose Launch Settings**, and see [Launch a subset of compose services](launch-profiles.md).
16
20
17
21
In *launchSettings.json*, the settings in the **Docker** section are related to how Visual Studio handles containerized apps.
18
22
@@ -61,22 +65,28 @@ The following table shows the properties that can be set in this section:
| commandLineArgs |`"commandLineArgs": "--mysetting myvalue"`| These command-line arguments for starting your app are used when launching your project in the container. |
67
-
| containerRunArguments|`"containerRunArguments": "-l mylabel=value"`|Like `dockerfileRunArguments`, but for use with the .NET SDK container build type. |
68
-
|DockerfileRunArguments|`dockerfileRunArguments": "-l mylabel=value"`|Additional arguments to pass to the [`docker run`](https://docs.docker.com/engine/reference/commandline/run/) command. <br>/<br/> This setting only applies to projects that use the Dockerfile container build type. <br/><br/> In Visual Studio 17.3 and later, you can use the following replacement tokens added:<br/><br/> - `{ProjectDir}` - Full path to the project directory. <br/><br/> - `{OutDir}` - The value of the MSBuild property OutDir.|
69
-
| environmentVariables |`"environmentVariables":` {<br/> `"ASPNETCORE_URLS": "https://+:443;http://+:80"`, <br/> `"ASPNETCORE_HTTPS_PORT": "44381"` <br/> } | These environment variable values are passed to the process when it's launched in the container. |
70
-
| httpPort |`"httpPort": 24051`| This port on the host is mapped to the container's port 80 when launching the container. |
71
-
| launchBrowser |`"launchBrowser": true`| Indicates whether to launch the browser after successfully launching the project. |
72
-
| launchBrowserTimeout |`"launchBrowserTimeout": 1`| The maximum amount of time (in seconds) to wait for the app to be ready before launching the browser. |
73
-
| launchUrl |`"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}"`| This URL is used when launching the browser. Supported replacement tokens for this string are: <br/><br/> - `{Scheme}` - Replaced with either `http` or `https`, depending on whether SSL is used. <br/><br/> - `{ServiceHost}` - Usually replaced with `localhost`. <br/> When you're targeting Windows containers on Windows 10 RS3 or older, though, it's replaced with the container's IP. <br/><br/> - `{ServicePort}` - Usually replaced with either sslPort or httpPort, depending on whether SSL is used. <br/> When you're targeting Windows containers on Windows 10 RS3 or older, though, it's replaced with either `443` or `80`, depending on whether SSL is used. |
74
-
| publishAllPorts |`"publishAllPorts": true`| If true, pass `-P` to `docker run`, which publishes all exposed ports to a random port. See [Docker documentation](https://docs.docker.com/engine/reference/commandline/run/). However, when you specify `sslPort`, Visual Studio still passes `-p 5002:443`, so your service should still be listening on port 5002.|
75
-
| sslPort |`"sslPort": 44381`| This port on the host is mapped to the container's port 443 when launching the container. |
76
-
| useSSL |`"useSSL": true`| Indicates whether to use SSL when launching the project. If `useSSL` isn't specified, then SSL is used when `sslPort > 0`. |
68
+
| Property in Debug Profile UI | Setting name in launchSettings.json |Example|Description|
69
+
| - | - | - | - |
70
+
|Command line arguments| commandLineArgs |`"commandLineArgs": "--mysetting myvalue"`| These command-line arguments for starting your app are used when launching your project in the container. |
71
+
|Container run arguments| containerRunArguments<br/>ContainerRunArguments|`"containerRunArguments": "-l mylabel=value"`| Additional arguments to pass to the [`docker run`](https://docs.docker.com/engine/reference/commandline/run/) command. <br><br/> (Use the lowercase version in Visual Studio 17.12 and later. The uppercase version was introduced in Visual Studio 17.9 and is provided for backward compatibility.) <br/><br/> You can use the following replacement tokens:<br/><br/> - `{ProjectDir}` - Full path to the project directory. <br/><br/> - `{OutDir}` - The value of the MSBuild property OutDir. |
72
+
|N/A|DockerfileRunArguments|`dockerfileRunArguments": "-l mylabel=value"`|Like `containerRunArguments`, but only for projects that use the Dockerfile build type. For Visual Studio 17.12 and later, it is recommended to use `containerRunArguments` instead.|
73
+
|Environment Variables| environmentVariables |`"environmentVariables":` {<br/> `"ASPNETCORE_URLS": "https://+:443;http://+:80"`, <br/> `"ASPNETCORE_HTTPS_PORT": "44381"` <br/> } | These environment variable values are passed to the process when it's launched in the container. |
74
+
|Container Name| containerName |`mycontainer`| (17.12 and later) A name for the container matching the regular expression `[a-zA-Z0-9][a-zA-Z0-9_.-]`.|
75
+
|Container environment files| containerRunEnvironmentFiles |`"containerRunEnvironmentFiles": "abc.env;xyz.env"`| (17.12 and later) A list of environment variable files (`.env` files) separated by semicolons. See [.env file syntax](https://docs.docker.com/compose/how-tos/environment-variables/variable-interpolation/#env-file-syntax). |
76
+
|Http Port| httpPort |`"httpPort": 24051`| This port on the host is mapped to the container's port 80 when launching the container. |
77
+
|Launch Browser| launchBrowser |`"launchBrowser": true`| Indicates whether to launch the browser after successfully launching the project. |
78
+
|N/A| launchBrowserTimeout |`"launchBrowserTimeout": 1`| The maximum amount of time (in seconds) to wait for the app to be ready before launching the browser (Docker Compose only). |
79
+
|Url | launchUrl |`"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}"`| This URL is used when launching the browser. Supported replacement tokens for this string are: <br/><br/> - `{Scheme}` - Replaced with either `http` or `https`, depending on whether SSL is used. <br/><br/> - `{ServiceHost}` - Usually replaced with `localhost`. <br/> When you're targeting Windows containers on Windows 10 RS3 or older, though, it's replaced with the container's IP. <br/><br/> - `{ServicePort}` - Usually replaced with either sslPort or httpPort, depending on whether SSL is used. <br/> When you're targeting Windows containers on Windows 10 RS3 or older, though, it's replaced with either `443` or `80`, depending on whether SSL is used. |
80
+
| Publish all ports | publishAllPorts |`"publishAllPorts": true`| If true, pass `-P` to `docker run`, which publishes all exposed ports to a random port. See [Docker documentation](https://docs.docker.com/engine/reference/commandline/run/). However, when you specify `sslPort`, Visual Studio still passes `-p 5002:443`, so your service should still be listening on port 5002.|
81
+
| Ssl Port| sslPort |`"sslPort": 44381`| This port on the host is mapped to the container's port 443 when launching the container. |
82
+
| N/A | useSSL |`"useSSL": true`| Indicates whether to use SSL when launching the project. If `useSSL` isn't specified, then SSL is used when `sslPort > 0`. |
83
+
84
+
Not all settings are available in the UI, for example, `useSSL`. To change those settings, edit `launchSettings.json` directly.
85
+
86
+
The setting `DockerfileRunArguments` is superceded in Visual Studio 2022 17.12 and later by `containerRunArguments`, which can be set in the Launch Profiles UI as `Container run arguments`.
77
87
78
88
> [!NOTE]
79
-
> If the same settings, for example, `DockerfileRunArguments`, is found in both the project file and in the launch settings file, the value in the launch settings file takes precedence.
89
+
> If the same setting is found in both the project file and in the launch settings file, the value in the launch settings file takes precedence.
0 commit comments