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
Copy file name to clipboardExpand all lines: docs/containers/container-build.md
+5
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,11 @@ ms.topic: how-to
9
9
---
10
10
# Customize Docker containers in Visual Studio
11
11
12
+
::: moniker range=">=vs-2022"
13
+
> [!NOTE]
14
+
> This article describes how you can customize your Docker containers when you choose the Dockerfile container build type. If you are using the .NET SDK build type, the customization options are different, and the information in this article is not applicable.
15
+
::: moniker-end
16
+
12
17
You can customize your container images by editing the Dockerfile that Visual Studio generates when you add Docker support to your project. Whether you're building a customized container from the Visual Studio IDE, or setting up a command-line build, you need to know how Visual Studio uses the Dockerfile to build your projects. You need to know such details because, for performance reasons, Visual Studio follows a special process for building and running containerized apps that isn't obvious from the Dockerfile.
13
18
14
19
Suppose you want to make a change in the Dockerfile and see the results in both debugging and in production containers. In that case, you can add commands in the Dockerfile to modify the first stage (usually `base`). See [Modify the container image for debugging and production](#modify-container-image-for-debugging-and-production). But, if you want to make a change only when debugging, but not production, then you should create another stage, and use the `DockerfileFastModeStage` build setting to tell Visual Studio to use that stage for debug builds. See [Modify the container image only for debugging](#modify-container-image-only-for-debugging).
Copy file name to clipboardExpand all lines: docs/containers/container-launch-settings.md
+9-3
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ ms.topic: reference
9
9
---
10
10
# Container Tools launch settings
11
11
12
-
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). In *launchSettings.json*, the settings in the **Docker** section are related to how Visual Studio handles containerized apps.
12
+
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). In *launchSettings.json*, the settings in the **Docker** section are related to how Visual Studio handles containerized apps.
13
13
14
14
```json
15
15
"Docker": {
@@ -27,7 +27,13 @@ In the *Properties* folder in an ASP.NET Core project, you can find the launchSe
27
27
}
28
28
```
29
29
30
-
The commandName setting identifies that this section applies to Container Tools. The following table shows the properties that can be set in this section:
30
+
The commandName setting identifies that this section applies to Container Tools.
31
+
32
+
:::moniker range=">=vs-2022"
33
+
Most of the settings in *launchSettings.json* are available and applicable whether you're using a Dockerfile, or using the .NET SDK's built-in container build support (available for .NET 7 and later).
34
+
:::moniker-end
35
+
36
+
The following table shows the properties that can be set in this section:
31
37
32
38
::: moniker range="vs-2019"
33
39
@@ -53,7 +59,7 @@ The commandName setting identifies that this section applies to Container Tools.
| commandLineArgs | "commandLineArgs": "--mysetting myvalue" | These command-line arguments for starting your app are used when launching your project in the container. |
56
-
|DockerfileRunArguments|"dockerfileRunArguments": "-l mylabel=value"|Additional arguments to pass to the [docker run](https://docs.docker.com/engine/reference/commandline/run/) command. In Visual Studio 17.3 Preview 2 and later, support for replacement tokens has been added:<br/><br/> - {ProjectDir} - Full path to the project directory. <br/><br/> - {OutDir} - The value of the MSBuild property OutDir.|
62
+
|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, support for replacement tokens has been added:<br/><br/> - {ProjectDir} - Full path to the project directory. <br/><br/> - {OutDir} - The value of the MSBuild property OutDir.|
57
63
| 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 is launched in the container. |
58
64
| httpPort | "httpPort": 24051 | This port on the host is mapped to the container's port 80 when launching the container. |
59
65
| launchBrowser | "launchBrowser": true | Indicates whether to launch the browser after successfully launching the project. |
Copy file name to clipboardExpand all lines: docs/containers/container-msbuild-properties.md
+5
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,11 @@ ms.topic: reference
9
9
---
10
10
# Container Tools build properties
11
11
12
+
::: moniker range=">=vs-2022"
13
+
> [!NOTE]
14
+
>This article describes the MSBuild properties that apply when you choose the Dockerfile container build type. If you are using the .NET SDK build type, the customization options are different, and the information in this article is not applicable.
15
+
::: moniker-end
16
+
12
17
You can customize how Visual Studio builds your container projects by setting the properties that MSBuild uses to build your project. For example, you can change the name of the Dockerfile, specify tags and labels for your images, provide additional arguments passed to Docker commands, and control whether Visual Studio does certain performance optimizations such as building outside of the container environment. You can also set debugging properties such as the name of the executable to launch, and the command line arguments to provide.
13
18
14
19
To set the value of a property, edit the project file. For example, suppose your Dockerfile is named *MyDockerfile*. You can set the `DockerfileFile` property in the project file as follows.
Copy file name to clipboardExpand all lines: docs/containers/hosting-web-apps-in-docker.md
-2
Original file line number
Diff line number
Diff line change
@@ -11,8 +11,6 @@ ms.author: ghogen
11
11
---
12
12
# Deploy an ASP.NET container to a container registry using Visual Studio
13
13
14
-
15
-
16
14
Docker is a lightweight container engine, similar in some ways to a virtual machine, which you can use to host applications and services.
17
15
This tutorial walks you through using Visual Studio to publish your containerized application to an [Azure Container Registry](https://azure.microsoft.com/services/container-registry).
Copy file name to clipboardExpand all lines: docs/containers/overview.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -49,7 +49,7 @@ Docker support is available for ASP.NET projects, ASP.NET Core projects, and .NE
49
49
50
50
The support for Docker in Visual Studio has changed over a number of releases in response to customer needs. There are several options to add Docker support to a project, and the supported options vary by the type of project and the version of Visual Studio. With some supported project types, if you just want a container for a single project, without using orchestration, you can do that by adding Docker support. The next level is container orchestration support, which adds appropriate support files for the particular orchestrator you choose.
51
51
52
-
With Visual Studio 2022 version 17.9 and later, when you add Docker support to a .NET 8 or later project, you have the option of using a Dockerfile to specify how to build the container images, or you can choose to use the built-in container support provides by the .NET SDK.
52
+
With Visual Studio 2022 version 17.9 and later, when you add Docker support to a .NET 7 or later project, you have two container build types to choose from for adding Docker support. You can choose to add a Dockerfile to specify how to build the container images, or you can choose to use the built-in container support provided by the .NET SDK.
53
53
54
54
Also, with Visual Studio 2022 and later, when you choose container orchestration, you can use Docker Compose or Service Fabric as container orchestration services.
With Visual Studio 2022 17.9 and later, and in projects that target .NET 8 or later, you have the option of using .NET SDK's built-in support for container builds, which means you don't need a Dockerfile. Instead, settings are encoded in a `.json` configuration file, *launchSettings.json*.
168
+
With Visual Studio 2022 17.9 and later, and in projects that target .NET 7 or later, you have the option of using .NET SDK's built-in support for container builds, which means you don't need a Dockerfile. Instead, settings are encoded in a `.json` configuration file, *launchSettings.json*.
169
169
170
170

0 commit comments