Skip to content

Commit 8f8804b

Browse files
authored
Container tools august (#8515)
* Toc and seo changes * seo work * Add CTW to overview * link to Containers window * start stubbing out sections * CTW work * fix image link * Continued improvements in CTW and linkage * Fix link * add Dockerfile and link to CTW in Container Build * fix link * change link wording * remove Kubernetes support * incorporate feedback * more feedback changes * Fix warning and suggestion * add gray border * add image and fix table * small fixes * fix typo * Add missing table entry * add link
1 parent 42aec4a commit 8f8804b

26 files changed

+140
-48
lines changed

docs/containers/container-build.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ Warmup will only happen in **Fast** mode, so the running container will have the
9797

9898
## Volume mapping
9999

100-
For debugging to work in containers, Visual Studio uses volume mapping to map the debugger and NuGet folders from the host machine. Volume mapping is described in the Docker documentation [here](https://docs.docker.com/storage/volumes/). Here are the volumes that are mounted in your container:
100+
For debugging to work in containers, Visual Studio uses volume mapping to map the debugger and NuGet folders from the host machine. Volume mapping is described in the Docker documentation [here](https://docs.docker.com/storage/volumes/). You can view the volume mappings for a container by using the [Containers window in Visual Studio](view-and-diagnose-containers.md).
101+
102+
Here are the volumes that are mounted in your container:
101103

102104
|Volume|Description|
103105
|-|-|

docs/containers/container-tools-configure.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,24 @@ The following table describes **Single Project** and **Docker Compose** settings
5656
| Name | Default Setting | Applies To | Description |
5757
| -----|:---------------:|:----------:| ----------- |
5858
| Pull required Docker images on project open | True | Single Project, Docker Compose | For increased performance when loading projects, Visual Studio will start a Docker pull operation in the background so that when you're ready to run your code, the image is already downloaded or in the process of downloading. If you're just loading projects and browsing code, you can set to **False** to avoid downloading container images you don't need. |
59+
| Pull updated Docker images on project open | .NET Core projects | Single Project, Docker Compose | When you open a project, check for updates to images and download if available. |
5960
| Run containers on project open | True | Single Project, Docker Compose | Again for increased performance, Visual Studio creates a container ahead of time so that it's ready for when you build and run your container. If you want to control when your container is created, set to **False**. |
60-
| Stop containers on project close | True | Single Project and Docker Compose | Set to **False** if you would like containers for your solution to continue to run after closing the solution or closing Visual Studio. |
61+
| Remove containers on project close | True | Single Project, Docker Compose | Set to **False** if you would like containers for your solution to be retained after closing the solution or closing Visual Studio. |
62+
63+
The **Containers Tool Window** settings control the settings that apply to the **Containers** tool window, which shows information about Docker containers and images. See [Use the Containers window](view-and-diagnose-containers.md)
64+
65+
![Visual Studio Container Tools Options, showing the settings available for the Containers tool window](media/configure-container-tools/tools-options-3.png)
66+
67+
The following table describes the **Containers** window settings:
68+
69+
70+
| Name | Default Setting | Description |
71+
| -----|:---------------:| ----------- |
72+
| Confirm before pruning containers | Always | Controls whether you are prompted when pruning unused containers. |
73+
| Confirm before pruning images | Always | Controls whether you are prompted when pruning unused images. |
74+
| Confirm before removing a container | Always | Controls whether you are prompted when removing a container. |
75+
| Confirm before removing an image | Always | Controls whether you are prompted when removing an image. |
76+
| Confirm before running large number of images | Always | Controls whether you are prompted before starting containers from more than 10 images at a time. |
6177

6278
::: moniker-end
6379
> [!WARNING]

docs/containers/includes/vs-2017/container-tools.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Visual Studio Container Tools with ASP.NET Core
2+
title: Visual Studio Container Tools for Docker with ASP.NET on Windows
33
author: ghogen
44
description: Learn how to use Visual Studio 2017 tooling and Docker for Windows
55
ms.author: ghogen

docs/containers/includes/vs-2019/container-tools.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Visual Studio Tools for Docker with ASP.NET
2+
title: Visual Studio Container Tools for Docker with ASP.NET on Windows
33
author: ghogen
44
description: Learn how to use Visual Studio 2019 tooling and Docker for Windows
55
ms.author: ghogen
@@ -84,7 +84,7 @@ In the window, find your container and step through each tab to view the environ
8484

8585
![Screenshot of Containers window](../../media/overview/vs-2019/container-tools-window.png)
8686

87-
For more information, see [View and diagnose containers and images in Visual Studio](../../view-and-diagnose-containers.md).
87+
For more information, see [Use the Containers window](../../view-and-diagnose-containers.md).
8888

8989
## Publish Docker images
9090

docs/containers/index.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,13 @@ landingContent:
5858
linkLists:
5959
- linkListType: how-to-guide
6060
links:
61-
- text: 'How to: Configure the build and debug environment'
62-
url: container-build.md
63-
- text: 'How to: View and diagnose containers'
61+
- text: 'Use the Containers window'
6462
url: view-and-diagnose-containers.md
65-
- text: 'How to: Troubleshoot container development tools'
63+
- text: 'Launch a subset of your Compose services'
64+
url: launch-profiles.md
65+
- text: 'Configure the build and debug environment'
66+
url: container-build.md
67+
- text: 'Troubleshoot container development tools'
6668
url: troubleshooting-docker-errors.md
6769

6870
- title: Container tools settings

docs/containers/launch-profiles.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ms.date: 05/10/2021
1010
ms.author: ghogen
1111
monikerRange: ">=vs-2019"
1212
---
13-
# Manage launch profiles for Docker Compose
13+
# Launch a subset of Compose services
1414

1515
If you have an application that consists of multiple services and uses Docker Compose, you can configure which services run and debug by creating or editing an existing launch profile in Docker Compose launch settings. Launch profiles allow you to dynamically run only the services that matter to your current scenario. You can create and select from launch profiles in order to customize your debugging experience and set specific launch actions such as `Browser Launch URL`. You will also have the option of either choosing each service individually or by choosing a Docker Compose profile, which also looks at your Compose file to determine the group of services to run.
1616

@@ -19,7 +19,7 @@ For information about Docker Compose profiles, see [Using profiles with Compose]
1919
## Prerequisites
2020

2121
- [Visual Studio 2019 version 16.10](https://visualstudio.microsoft.com/vs/) or later
22-
- A solution with [Container Orchestration with Docker Compose](tutorial-multicontainer.md)
22+
- A .NET solution with [Container Orchestration with Docker Compose](tutorial-multicontainer.md)
2323

2424
## Manage launch settings
2525

Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

docs/containers/overview.md

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
---
2-
title: Visual Studio Container Tools on Windows
2+
title: Visual Studio Container Tools for Docker on Windows
33
description: Get to know the tools available in Visual Studio for working with Docker
44
author: ghogen
55
ms.author: ghogen
66
ms.topic: overview
7-
ms.date: 03/20/2019
7+
ms.date: 08/24/2021
88
ms.technology: vs-container-tools
99
---
10-
# Container Tools in Visual Studio
10+
# Visual Studio Container Tools for Docker
1111

12-
The tools included in Visual Studio for developing with containers are easy to use, and greatly simplify building, debugging, and deployment for containerized applications. You can work with a container for a single project, or use container orchestration with Docker Compose, Service Fabric, or Kubernetes to work with multiple services in containers.
12+
The tools included in Visual Studio for developing with Docker containers are easy to use, and greatly simplify building, debugging, and deployment for containerized applications. You can work with a container for a single project, or use container orchestration with Docker Compose or Service Fabric to work with multiple services in containers.
1313

1414
::: moniker range="vs-2017"
1515

@@ -21,14 +21,14 @@ The tools included in Visual Studio for developing with containers are easy to u
2121

2222
## Docker support in Visual Studio
2323

24-
Docker support is available for ASP.NET projects, ASP.NET Core projects, and .NET Core and .NET Framework console projects.
24+
Docker support is available for ASP.NET projects, ASP.NET Core projects, Azure Functions, and .NET Core and .NET Framework console projects.
2525

2626
The support for Docker in Visual Studio has changed over a number of releases in response to customer needs. There are two levels of Docker support you can add 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.
2727

28-
With Visual Studio 2017, you can use Docker Compose and Service Fabric as container orchestration services. You can also use Kubernetes if you install the [Visual Studio Tools for Kubernetes](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vs-tools-for-kubernetes).
28+
With Visual Studio 2017, you can use Docker Compose and Service Fabric as container orchestration services.
2929

3030
> [!NOTE]
31-
> If you are using a version of Visual Studio 2017 prior to 15.8, or you are using the .NET Framework project template (not .NET Core), when you add Docker support, orchestration support using Docker Compose is added automatically. Container orchestration support, via Docker Compose, is added automatically in Visual Studio 2017 versions 15.0 to 15.7 and for .NET Framework projects.
31+
> If you are using a version of Visual Studio 2017 prior to 15.8, or you are using the .NET Framework project template (not .NET Core), when you add Docker support, orchestration support using Docker Compose is added automatically.
3232
3333
::: moniker-end
3434

@@ -52,7 +52,7 @@ With Visual Studio 2019, you can use Docker Compose, Kubernetes, and Service Fab
5252
> [!NOTE]
5353
> If you are using the full .NET Framework console project template, the supported option is **Add Container Orchestrator support** after project creation, with options to use Service Fabric or Docker Compose. Adding support at project creation and **Add Docker support** for a single project without orchestration are not available options.
5454
55-
In Visual Studio 2019 version 16.4 and later, the **Containers** window is available, which lets you view running containers, browse available images, view environment variables, logs, and port mappings, inspect the filesystem, attach a debugger, or open a terminal window inside the container environment. See [View and diagnose containers and images in Visual Studio](view-and-diagnose-containers.md).
55+
In Visual Studio 2019 version 16.4 and later, the **Containers** window is available, which lets you view running containers, browse available images, view environment variables, logs, and port mappings, inspect the filesystem, attach a debugger, or open a terminal window inside the container environment. See [Use the Containers window](view-and-diagnose-containers.md).
5656

5757
::: moniker-end
5858

@@ -80,11 +80,32 @@ When you add or enable Docker support, Visual Studio adds the following to the p
8080
- a .dockerignore file
8181
- a NuGet package reference to the Microsoft.VisualStudio.Azure.Containers.Tools.Targets
8282

83-
::: moniker range=">=vs-2019"
84-
The solution looks like this once you add Docker support:
83+
The Dockerfile you add will resemble the following code. In this example, the project was named `WebApplication-Docker`.
8584

86-
![Screenshot of solution explorer with Dockerfile and .dockerignore file](media/overview/vs-2019/dockerfile-dockerignore.png)
87-
::: moniker-end
85+
```Dockerfile
86+
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
87+
88+
FROM mcr.microsoft.com/dotnet/aspnet:3.1 AS base
89+
WORKDIR /app
90+
EXPOSE 80
91+
EXPOSE 443
92+
93+
FROM mcr.microsoft.com/dotnet/sdk:3.1 AS build
94+
WORKDIR /src
95+
COPY ["WebApplication-Docker/WebApplication-Docker.csproj", "WebApplication-Docker/"]
96+
RUN dotnet restore "WebApplication-Docker/WebApplication-Docker.csproj"
97+
COPY . .
98+
WORKDIR "/src/WebApplication-Docker"
99+
RUN dotnet build "WebApplication-Docker.csproj" -c Release -o /app/build
100+
101+
FROM build AS publish
102+
RUN dotnet publish "WebApplication-Docker.csproj" -c Release -o /app/publish
103+
104+
FROM base AS final
105+
WORKDIR /app
106+
COPY --from=publish /app/publish .
107+
ENTRYPOINT ["dotnet", "WebApplication-Docker.dll"]
108+
```
88109

89110
::: moniker range="vs-2017"
90111
> [!NOTE]
@@ -93,6 +114,18 @@ The solution looks like this once you add Docker support:
93114
![Enable Docker compose support for an ASP.NET project](media/overview/enable-docker-compose-support.png)
94115
::: moniker-end
95116

117+
## Use the Containers window
118+
119+
The **Containers** window lets you view containers and images on your machine and see what's going on with them. You can view the filesystem, volumes mounted, environment variables, ports used, and examine log files.
120+
121+
Open the **Containers** window by using the quick launch (**Ctrl**+**Q**) and typing `containers`. You can use the docking controls to put the window somewhere. Because of the width of the window, it works best when docked at the bottom of the screen.
122+
123+
Select a container, and use the tabs to view the information that's available. To check it out, run your Docker-enabled app, open the **Files** tab, and expand the **app** folder to see your deployed app on the container.
124+
125+
![Screenshot of Containers window](media/overview/vs-2019/container-tools-window-2.png)
126+
127+
For more information, see [Use the Containers window](view-and-diagnose-containers.md).
128+
96129
## Docker Compose support
97130

98131
When you want to compose a multi-container solution using Docker Compose, add container orchestration support to your projects. This lets you run and debug a group of containers (a whole solution or group of projects) at the same time if they're defined in the same *docker-compose.yml* file.
@@ -107,13 +140,7 @@ If *docker-compose.yml* already exists, Visual Studio just adds the required lin
107140

108141
Repeat the process with the other projects that you want to control using Docker Compose.
109142

110-
## Kubernetes support
111-
112-
::: moniker range="vs-2017"
113-
To add Kubernetes support, install the [Visual Studio Tools for Kubernetes](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vs-tools-for-kubernetes).
114-
::: moniker-end
115-
116-
With Kubernetes support, you can enable a connection between your local project and a Kubernetes cluster running in [Azure Kubernetes Service (AKS)](/azure/aks), and thereby modify and debug your services running using Visual Studio. This service is provided by [Bridge to Kubernetes](/visualstudio/bridge/overview-bridge-to-kubernetes).
143+
If you work with a large number of services, you can save time and computing resources by selecting which subset of services you want to start in your debugging session. See [Start a subset of Compose services](launch-profiles.md).
117144

118145
## Service Fabric support
119146

docs/containers/toc.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,22 @@
1717
- name: Multi-container app with Docker Compose
1818
href: tutorial-multicontainer.md
1919
- name: How to
20+
expanded: true
2021
items:
2122
- name: Debug app in a local Docker container
2223
href: edit-and-refresh.md
24+
- name: Use the Containers window
25+
href: view-and-diagnose-containers.md
26+
- name: Launch a subset of Compose services
27+
href: launch-profiles.md
28+
- name: Configure Container Tools
29+
href: container-tools-configure.md
2330
- name: Deploy to a container registry
2431
href: hosting-web-apps-in-docker.md
2532
- name: Deploy to Azure App Service
2633
href: deploy-app-service.md
2734
- name: Deploy to Docker Hub
2835
href: deploy-docker-hub.md
29-
- name: Manage launch profiles
30-
href: launch-profiles.md
31-
- name: View and diagnose containers and images
32-
href: view-and-diagnose-containers.md
33-
- name: Configure Container Tools
34-
href: container-tools-configure.md
3536
- name: Concepts
3637
items:
3738
- name: How Visual Studio builds containerized apps

docs/containers/tutorial-multicontainer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ Add a project to the same solution and call it *MyWebAPI*. Select **API** as the
197197
198198
Look at the options for deploying your [containers to Azure](/azure/containers).
199199
200-
For greater control over which services are started during a debug session, learn how to use Docker Compose launch profiles to configure which services run when debugging. See [Manage launch profiles for Docker Compose](launch-profiles.md)
200+
If you work with a large number of microservices, many of which aren't needed for a every debugging task, you can use Docker Compose launch profiles for greater control over which services are started during a debug session. See [Manage launch profiles for Docker Compose](launch-profiles.md).
201201
202202
## See also
203203

0 commit comments

Comments
 (0)