Skip to content

Commit 18e6389

Browse files
authored
Merge pull request #9485 from MicrosoftDocs/main638265279187495996sync_temp
Repo sync for protected CLA branch
2 parents b8d0a1b + f51c921 commit 18e6389

File tree

4 files changed

+39
-5
lines changed

4 files changed

+39
-5
lines changed

docs/containers/container-tools.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ With Visual Studio, you can easily build, debug, and run containerized .NET, ASP
2323
## Prerequisites
2424

2525
* [Docker Desktop](https://hub.docker.com/editions/community/docker-ce-desktop-windows)
26-
* [Visual Studio 2022](https://visualstudio.microsoft.com/downloads) with the **Web Development**, **Azure Tools** workload, and/or **.NET Core cross-platform development** workload installed
27-
* [.NET Core Development Tools](https://dotnet.microsoft.com/download/dotnet-core/) for development with .NET Core
26+
* [Visual Studio 2022](https://visualstudio.microsoft.com/downloads) with the **Web Development**, **Azure Tools** workload, and/or **.NET desktop development** workload installed
2827
* To publish to Azure Container Registry, an Azure subscription. [Sign up for a free trial](https://azure.microsoft.com/free/dotnet/).
2928

3029
## Installation and setup
@@ -71,10 +70,20 @@ COPY --from=publish /app/publish .
7170
ENTRYPOINT ["dotnet", "WebApplication3.dll"]
7271
```
7372

74-
The preceding *Dockerfile* is based on the [Microsoft Container Registry (MCR)](https://azure.microsoft.com/blog/microsoft-syndicates-container-catalog/) .NET 6 image image, and includes instructions for modifying the base image by building your project and adding it to the container. If you're using the .NET Framework, the base image will be different.
73+
The preceding *Dockerfile* is based on the [Microsoft Container Registry (MCR)](https://azure.microsoft.com/blog/microsoft-syndicates-container-catalog/) .NET 6 image and includes instructions for modifying the base image by building your project and adding it to the container. If you're using the .NET Framework, the base image will be different.
7574

7675
When the new project dialog's **Configure for HTTPS** check box is checked, the *Dockerfile* exposes two ports. One port is used for HTTP traffic; the other port is used for HTTPS. If the check box isn't checked, a single port (80) is exposed for HTTP traffic.
7776

77+
With Visual Studio 2022 version 17.7 or later, you can target [.NET 8 preview](https://dotnet.microsoft.com/download/). In that case, you have the benefit of being able to run your app more securely, as a normal user, rather than with elevated permissions. The default Dockerfile generated by Visual Studio for .NET 8 projects is configured to run as a normal user. To enable this on an existing project, add the line `USER app` to the Dockerfile in the base image. Also, because port 80 is restricted for normal users, expose ports 8080 and 8081 instead of 80 and 443. Port 8080 is used for HTTP traffic, and port 8081 is used for HTTPS. To run as a normal user, the container must use a .NET 8 base image, and the app must run as a .NET 8 app. When configured correctly, your Dockerfile should contain code as in the following example:
78+
79+
```dockerfile
80+
FROM mcr.microsoft.com/dotnet/aspnet:8.0-preview AS base
81+
USER app
82+
WORKDIR /app
83+
EXPOSE 8080
84+
EXPOSE 8081
85+
```
86+
7887
## Debug
7988

8089
Select **Docker** from the debug drop-down in the toolbar, and start debugging the app. You might see a message with a prompt about trusting a certificate; choose to trust the certificate to continue.
Loading

docs/containers/view-and-diagnose-containers.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ You can also view information about container images using the **Containers** wi
2626
:::moniker range=">=vs-2022"
2727
- [Docker Desktop](https://hub.docker.com/editions/community/docker-ce-desktop-windows)
2828
- [Visual Studio 2022](https://visualstudio.microsoft.com/downloads) or [Visual Studio 2019 version 16.4](https://visualstudio.microsoft.com/downloads) or later.
29+
- For the Docker Compose node, [Visual Studio 2022 version 17.7 or later](https://visualstudio.microsoft.com/downloads) and Docker v2, which is installed with Docker Desktop and on by default.
2930

3031
:::moniker-end
3132

@@ -45,9 +46,16 @@ On the left side, you see the list of containers on your local machine. The cont
4546
> [!TIP]
4647
> You can easily customize where the **Containers** tool window is docked in Visual Studio. See [Customizing window layouts in Visual Studio](../ide/customizing-window-layouts-in-visual-studio.md). By default, the **Containers** window is docked with the **Watch** window when the debugger is running.
4748
49+
:::moniker range=">=vs-2022"
50+
51+
If you're using Docker Compose and Visual Studio 2022 version 17.7 or later, you see a tree of nodes for your solution and its Docker Compose project, with a parent node for the solution and child nodes for each project, as you can see the following image:
52+
53+
![Screenshot showing Docker Compose nodes in the Containers window.](./media/view-and-diagnose-containers/vs-2022/containers-logs-interleaved.png)
54+
:::moniker-end
55+
4856
## View environment variables
4957

50-
The **Environment** tab shows the environment variables in the container. For your app's container, you can set these variables in many ways, for example, in the Dockerfile, in a .env file, or by using the -e option when you start a container using a Docker command.
58+
The **Environment** tab shows the environment variables in the container. For your app's container, you can set these variables in many ways, for example, in the Dockerfile, in an .env file, or by using the -e option when you start a container using a Docker command.
5159

5260
:::moniker range="vs-2019"
5361
![Screenshot of the Containers window in Visual Studio showing the Environment variables for a container.](media/view-and-diagnose-containers/containers-environment-vars.png)
@@ -94,7 +102,7 @@ The **Volumes** tab shows the volumes (mounted filesystem nodes) on the containe
94102

95103
## View logs
96104

97-
The **Logs** tab shows the results of the `docker logs` command. By default, the tab shows stdout and stderr streams on a container, but you can configure the output. For details, see [Docker logging](https://docs.docker.com/config/containers/logging/). By default, the **Logs** tab streams the logs, but you can disable that by choosing the **Stop** button on the tab.
105+
The **Logs** tab shows the results of the `docker logs` command. By default, the tab shows stdout and stderr streams on a container, but you can configure the output. For details, see [Docker logging](https://docs.docker.com/config/containers/logging/). By default, the **Logs** tab streams the logs, but you can pause that by choosing the **Stream** button on the tab. If you press **Stream** again, the streaming resumes from where it left off.
98106

99107
:::moniker range="vs-2019"
100108
![Screenshot of Logs tab in Containers window.](media/view-and-diagnose-containers/containers-logs.png)
@@ -108,6 +116,12 @@ To clear the logs, use the **Clear** button on the **Logs** tab. To get all the
108116
> [!NOTE]
109117
> Visual Studio automatically redirects stdout and stderr to the **Output** window when you run without debugging with Windows containers, so Windows containers started from Visual Studio using **Ctrl**+**F5** will not display logs in this tab; use the **Output** window instead.
110118
119+
:::moniker range=">=vs-2022"
120+
If you're using Docker Compose with Visual Studio 2022 version 17.7 or later, you have the option of viewing logs of each container separately, or interleaved into a single output stream. If you select the parent node for the solution, you see interleaved logs from all the Compose projects. The first column on each line shows the container that produced that line of output. If you only want to see the logs for one container by itself, select that specific project's node.
121+
122+
![Screenshot showing interleaved logs in the Logs tab of the Containers window.](./media/view-and-diagnose-containers/vs-2022/containers-logs-interleaved.png)
123+
:::moniker-end
124+
111125
## View the filesystem
112126

113127
On the **Files** tab, you can view the container's filesystem, including the app folder that contains your project.
@@ -130,6 +144,10 @@ To open files in Visual Studio, browse to the file and double-click it, or right
130144

131145
Using the **Files** tab, you can view application logs such as IIS logs, configuration files, and other content files in your container's filesystem.
132146

147+
:::moniker range=">=vs-2022"
148+
In Visual Studio 2022 version 17.7 or later, when targeting .NET 8 or later, the Dockerfile might contain the `USER app` command, which specifies to run the app with normal user permissions. The **Files** tab uses those permissions as well, and so you might not be able to view some folders, if those folders are set to require elevated permissions to view.
149+
:::moniker-end
150+
133151
## Start, stop, and remove containers
134152

135153
By default, the **Containers** window shows all containers on the machine that Docker manages. You can use the toolbar buttons to start, stop, or remove (delete) a container you no longer want. This list is dynamically updated as containers are created or removed.
@@ -156,6 +174,10 @@ For Windows containers, the Windows command prompt opens. For Linux containers,
156174
![Screenshot of bash window.](media/view-and-diagnose-containers/vs-2022/container-bash-window.png)
157175
:::moniker-end
158176

177+
:::moniker range=">=vs-2022"
178+
If you're targeting .NET 8, your Dockerfile can specify the `USER app` command, which means your app runs with normal user permissions, rather than elevated permissions. The Dockerfile generated by Visual Studio includes this in Visual Studio 2022 version 17.7 and later, if you're targeting .NET 8 or later. The terminal opens as the user specified in the Dockerfile (by default for .NET 8 projects, that's `app`), or if no user is specified, it runs as the `root` user.
179+
:::moniker-end
180+
159181
Normally, the terminal window opens outside Visual Studio as a separate window. If you want a command-line environment integrated into the Visual Studio IDE as a dockable tool window, you can install [Whack Whack Terminal](https://marketplace.visualstudio.com/items?itemName=DanielGriffen.WhackWhackTerminal).
160182

161183
## Attach the debugger to a process

subscriptions/whats-new-in-subscriptions.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ All Visual Studio subscriptions that include the Visual Studio IDE will now have
1919

2020
### Admin access to expired agreements
2121
Administrators can now view information in their expired agreements. This enables them to more easily migrate subscribers to new agreements.
22+
23+
24+
[comment]: # (Test comment)

0 commit comments

Comments
 (0)