Skip to content

Commit

Permalink
Updates Containerized Docker Application Lifecycle - ebook content to…
Browse files Browse the repository at this point in the history
… .NET 6.0 (#27449)

* Updated index page to .NET 6.0

* Updated build ASP.NET Core application to .NET 6.0

* Removed DevSpace related content

* Updated VS version to 2022

* Updated Visual Studio screnshots

* Updated container apps logo

* Updated content to .NET 6.0

* Updated screenshots

* Updated file dates

* Update docs/architecture/containerized-lifecycle/design-develop-containerized-apps/build-aspnet-core-applications-linux-containers-aks-kubernetes.md

Co-authored-by: David Pine <[email protected]>

* Updated docker related description

* Updated visual studio version

* Removed Docker Enterprise reference

* Updated Visual Studio version information

* Updated Visual Studio App Service image

* Updated docker configuration tool options.

* Fixed relative path links

* Update docs/architecture/containerized-lifecycle/docker-terminology.md

Co-authored-by: Nish Anil <[email protected]>
Co-authored-by: David Pine <[email protected]>
  • Loading branch information
3 people authored Dec 14, 2021
1 parent 1231500 commit d6bed51
Show file tree
Hide file tree
Showing 15 changed files with 36 additions and 82 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Build ASP.NET Core applications deployed as Linux containers into AKS/Kubernetes clusters
description: Learn about creating ASP.NET Core applications deployed as Linux containers into AKS/Kubernetes clusters
ms.date: 01/06/2021
ms.date: 12/08/2021
---

# Build ASP.NET Core applications deployed as Linux containers into an AKS/Kubernetes orchestrator
Expand All @@ -16,33 +16,33 @@ AKS main features are:
- User-configurable scaling
- Simpler user experience for both developers and cluster operators.

The following examples explore the creation of an ASP.NET Core 5.0 application that runs on Linux and deploys to an AKS Cluster in Azure, while development is done using Visual Studio 2019 version 16.8.
The following examples explore the creation of an ASP.NET Core 6.0 application that runs on Linux and deploys to an AKS Cluster in Azure, while development is done using Visual Studio 2022 version 17.0.

## Creating the ASP.NET Core Project using Visual Studio 2019
## Creating the ASP.NET Core Project using Visual Studio 2022

ASP.NET Core is a general-purpose development platform maintained by Microsoft and the .NET community on GitHub. It's cross-platform, supporting Windows, macOS and Linux, and can be used in device, cloud, and embedded/IoT scenarios.

This example uses a couple of simple projects based on Visual Studio templates, so you don't need much additional knowledge to create the sample. You only have to create the project using a standard template that includes all the elements to run a small project with a REST API and a Web App with Razor pages, using ASP.NET Core 5.0 technology.
This example uses a couple of simple projects based on Visual Studio templates, so you don't need much additional knowledge to create the sample. You only have to create the project using a standard template that includes all the elements to run a small project with a REST API and a Web App with Razor pages, using ASP.NET Core 6.0 technology.

![Add new project window in Visual Studio, selecting ASP.NET Core Web Application.](media/build-aspnet-core-applications-linux-containers-aks-kubernetes/create-aspnet-core-application.png)

**Figure 4-35**. Creating an ASP.NET Core Web Application in Visual Studio 2019.
**Figure 4-35**. Creating an ASP.NET Core Web Application in Visual Studio 2022.

To create the sample project in Visual Studio, select **File** > **New** > **Project**, select the **Web** project type and then the **ASP.NET Core Web Application** template. You can also search for the template if you need it.

Then enter the application name and location as shown in the next image.

![Enter the project name and location.](media/build-aspnet-core-applications-linux-containers-aks-kubernetes/enter-project-name-and-location.png)

**Figure 4-36**. Enter the project name and location in Visual Studio 2019.
**Figure 4-36**. Enter the project name and location in Visual Studio 2022.

Verify that you've selected ASP.NET Core 5.0 as the framework. .NET 5 is included in the latest release of Visual Studio 2019 and is automatically installed and configured for you when you install Visual Studio.
Verify that you've selected ASP.NET Core 6.0 as the framework. .NET 6 is included in the latest release of Visual Studio 2022 and is automatically installed and configured for you when you install Visual Studio.

![Visual Studio dialog for selecting the type of an ASP.NET Core Web Application with API option selected.](media/build-aspnet-core-applications-linux-containers-aks-kubernetes/create-web-api-application.png)

**Figure 4-37**. Selecting ASP.NET CORE 5.0 and Web API project type
**Figure 4-37**. Selecting ASP.NET CORE 6.0 and Web API project type

Notice Docker support is not enabled now. You'll do that in the next step after the project creation.
Notice Docker support is not enabled now. You'll do that in the next step after the project creation. You'll also notice that by default controller option is checked. You can uncheck that if you want to [Create a minimal web API with ASP.NET Core](/aspnet/core/tutorials/min-web-api?view=aspnetcore-6.0&tabs=visual-studio).

To show you can "Dockerize" your project at any time, you'll add Docker support now. So right-click on the project node in Solution Explorer and select **Add** > **Docker support** on the context menu.

Expand All @@ -56,7 +56,7 @@ To complete adding Docker support, you can choose Windows or Linux. In this case

**Figure 4-39**. Selecting Linux containers.

With these simple steps, you have your ASP.NET Core 5.0 application running on a Linux container.
With these simple steps, you have your ASP.NET Core 6.0 application running on a Linux container.

In a similar way, you can also add a very simple **WebApp** project (Figure 4-40) to consume the web API endpoint, although the details are not discussed here.

Expand Down Expand Up @@ -151,7 +151,7 @@ When running the docker-compose application as explained, you get:

1. The images built and containers created as per the docker-compose file.
2. The browser open in the address configured in the "Properties" dialog for the `docker-compose` project.
3. The **Container** window open (in Visual Studio 2019 version 16.4 and later).
3. The **Container** window open (in Visual Studio 2022 version 17.0 and later).
4. Debugger support for all projects in the solution, as shown in the following images.

Browser opened:
Expand All @@ -168,9 +168,9 @@ Containers window:

The **Containers** window 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.

As you can see, the integration between Visual Studio 2019 and Docker is completely oriented to the developer's productivity.
As you can see, the integration between Visual Studio 2022 and Docker is completely oriented to the developer's productivity.

Of course, you can also list the images using the `docker images` command. You should see the `webapi` and `webapp` images with the `dev` tags created by the automatic deployment of our project with Visual Studio 2019.
Of course, you can also list the images using the `docker images` command. You should see the `webapi` and `webapp` images with the `dev` tags created by the automatic deployment of our project with Visual Studio 2022.

```console
docker images
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Development environment for Docker apps
description: Get to know the most important development tool options that support the Docker development life-cycle.
ms.date: 01/06/2021
ms.date: 12/08/2021
---
# Development environment for Docker apps

Expand All @@ -20,7 +20,7 @@ If you prefer a lightweight, cross-platform editor supporting any development la
### Visual Studio with Docker Tools (Windows development machine)

It's recommend that you use Visual Studio 2019 with the built-in Docker Tools enabled. With Visual Studio, you can develop, run, and validate your applications directly in the chosen Docker environment. Press F5 to debug your application (single container or multiple containers) directly in a Docker host, or press Ctrl+F5 to edit and refresh your app without having to rebuild the container. It's the simplest and most powerful choice for Windows developers to create Docker containers for Linux or Windows.
It's recommended that you use Visual Studio 2022 or later with the built-in Docker Tools enabled. With Visual Studio, you can develop, run, and validate your applications directly in the chosen Docker environment. Press F5 to debug your application (single container or multiple containers) directly in a Docker host, or press Ctrl+F5 to edit and refresh your app without having to rebuild the container. It's the simplest and most powerful choice for Windows developers to create Docker containers for Linux or Windows.

### Visual Studio for Mac (Mac development machine)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Inner-loop development workflow for Docker apps
description: Learn about "inner-loop" development workflow for Docker applications.
ms.date: 01/06/2021
ms.date: 12/08/2021
---

# Inner-loop development workflow for Docker apps
Expand Down Expand Up @@ -114,12 +114,12 @@ Using an official repository of a language stack with a version number ensures t
The following is a sample DockerFile for a .NET container:

```dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["src/WebApi/WebApi.csproj", "src/WebApi/"]
RUN dotnet restore "src/WebApi/WebApi.csproj"
Expand All @@ -136,7 +136,7 @@ COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "WebApi.dll"]
```

In this case, the image is based on version 5.0 of the official ASP.NET Core Docker image (multi-arch for Linux and Windows), as per the line `FROM mcr.microsoft.com/dotnet/aspnet:5.0`. (For more information about this topic, see the [ASP.NET Core Docker Image](https://hub.docker.com/_/microsoft-dotnet-aspnet/) page and the [.NET Docker Image](https://hub.docker.com/_/microsoft-dotnet/) page).
In this case, the image is based on version 6.0 of the official ASP.NET Core Docker image (multi-arch for Linux and Windows), as per the line `FROM mcr.microsoft.com/dotnet/aspnet:6.0`. (For more information about this topic, see the [ASP.NET Core Docker Image](https://hub.docker.com/_/microsoft-dotnet-aspnet/) page and the [.NET Docker Image](https://hub.docker.com/_/microsoft-dotnet/) page).

In the DockerFile, you can also instruct Docker to listen to the TCP port that you'll use at run time (such as port 80 or 443).

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Either because you want to get a quick validation of a container deployed to Azu

Using Azure App Service is intuitive and you can get up and running quickly because it provides great Git integration to take your code, build it in Microsoft Visual Studio, and directly deploy it to Azure. But, traditionally (with no Docker), if you needed other capabilities, frameworks, or dependencies that aren't supported in App Services, you needed to wait for it until the Azure team updates those dependencies in App Service or switched to other services like Service Fabric, Cloud Services, or even plain VMs, for which you have further control and can install a required component or framework for your application.

Now, as shown in Figure 4-4, when using Visual Studio 2019, container support in Azure App Service gives you the ability to include whatever you want in your app environment. If you added a dependency to your app, because you're running it in a container, you get the capability of including those dependencies in your Dockerfile or Docker image.
Now, as shown in Figure 4-4, when using Visual Studio 2022, container support in Azure App Service gives you the ability to include whatever you want in your app environment. If you added a dependency to your app, because you're running it in a container, you get the capability of including those dependencies in your Dockerfile or Docker image.

![Screenshot of Create App Service dialog showing a Container Registry.](./media/monolithic-applications/publish-azure-app-service-container.png)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Orchestrating microservices and multi-container applications for high scalability and availability
description: Real production applications have to be deployed and managed with orchestrators that handle the health, workload and life cycles of all containers.
ms.date: 08/06/2020
ms.date: 12/08/2021
---
# Orchestrating microservices and multi-container applications for high scalability and availability

Expand Down Expand Up @@ -35,6 +35,7 @@ The concepts of a cluster and a scheduler are closely related, so the products p
| **Azure Kubernetes Service (AKS)** <br/> ![An image of the Azure Kubernetes Service logo.](./media/orchestrate-high-scalability-availability/azure-kubernetes-service-logo.png) | [Azure Kubernetes Service (AKS)](https://azure.microsoft.com/services/kubernetes-service/) is a managed Kubernetes container orchestration service in Azure that simplifies Kubernetes cluster's management, deployment, and operations. |
| **Azure Service Fabric** <br/> ![An image of the Azure Service Fabric logo.](./media/orchestrate-high-scalability-availability/azure-service-fabric-logo.png) | [Service Fabric](/azure/service-fabric/service-fabric-overview) is a Microsoft microservices platform for building applications. It's an [orchestrator](/azure/service-fabric/service-fabric-cluster-resource-manager-introduction) of services and creates clusters of machines. Service Fabric can deploy services as containers or as plain processes. It can even mix services in processes with services in containers within the same application and cluster. <br/> <br/> *Service Fabric* clusters can be deployed in Azure, on-premises or in any cloud. However, deployment in Azure is simplified with a managed approach. <br/> <br/> *Service Fabric* provides additional and optional prescriptive [Service Fabric programming models](/azure/service-fabric/service-fabric-choose-framework) like [stateful services](/azure/service-fabric/service-fabric-reliable-services-introduction) and [Reliable Actors](/azure/service-fabric/service-fabric-reliable-actors-introduction). <br/> <br/> *Service Fabric* is mature in Windows (years evolving in Windows), less mature in Linux. <br/> <br/> Both Linux and Windows containers are supported in Service Fabric since 2017. |
| **Azure Service Fabric Mesh** <br/> ![An image of the Azure Service Fabric Mesh logo.](./media/orchestrate-high-scalability-availability/azure-service-fabric-mesh-logo.png) | [*Azure Service Fabric Mesh*](/azure/service-fabric-mesh/service-fabric-mesh-overview) offers the same reliability, mission-critical performance and scale as Service Fabric, but also offers a fully managed and serverless platform. You don't need to manage a cluster, VMs, storage or networking configuration. You just focus on your application's development. <br/> <br/> *Service Fabric Mesh* supports both Windows and Linux containers, allowing you to develop with any programming language and framework of your choice.
| **Azure Container Apps** <br> ![An image of the Azure Container Apps Service logo.](./media/orchestrate-high-scalability-availability/azure-container-apps-logo.png) | [Azure Container Apps](https://azure.microsoft.com/services/container-apps/) is a managed serverless container service for building and deploying modern apps at scale. |

## Using container-based orchestrators in Azure

Expand Down Expand Up @@ -74,44 +75,15 @@ For further implementation information on deployment to Kubernetes based on `kub

When deploying an application to a Kubernetes cluster, you can use the original `kubectl.exe` CLI tool using deployment files based on the native format (`.yaml` files), as already mentioned in the previous section. However, for more complex Kubernetes applications such as when deploying complex microservice-based applications, it's recommended to use [Helm](https://helm.sh/).

Helm Charts helps you define, version, install, share, upgrade, or rollback even the most complex Kubernetes application.

Going further, Helm usage is also recommended because additional Kubernetes environments in Azure, such as [Azure Dev Spaces](/azure/dev-spaces/azure-dev-spaces) are also based on Helm charts.

Helm is maintained by the [Cloud Native Computing Foundation (CNCF)](https://www.cncf.io/) in collaboration with Microsoft, Google, Bitnami, and the Helm contributor community.
Helm Charts helps you define, version, install, share, upgrade, or rollback even the most complex Kubernetes application. Helm is maintained by the [Cloud Native Computing Foundation (CNCF)](https://www.cncf.io/) in collaboration with Microsoft, Google, Bitnami, and the Helm contributor community.

For further implementation information on Helm charts and Kubernetes, see the section called [Install eShopOnContainers using Helm](https://github.com/dotnet-architecture/eShopOnContainers/wiki/Deploy-to-Azure-Kubernetes-Service-(AKS)#install-eshoponcontainers-using-helm).

## Use Azure Dev Spaces for you Kubernetes application lifecycle

[Azure Dev Spaces](/azure/dev-spaces/azure-dev-spaces) provides a rapid, iterative Kubernetes development experience for teams. With minimal dev machine setup, you can iteratively run and debug containers directly in Azure Kubernetes Service (AKS). You can develop on Windows, Mac, or Linux using familiar tools like Visual Studio, Visual Studio Code, or the command line.

As mentioned, Azure Dev Spaces uses Helm charts when deploying container-based applications.

Azure Dev Spaces helps development teams be more productive on Kubernetes because it allows you to rapidly iterate and debug code directly in a global Kubernetes cluster in Azure by just using Visual Studio 2017 or Visual Studio Code. That Kubernetes cluster in Azure is a shared managed Kubernetes cluster, so your team can collaboratively work together. You can develop your code in isolation, then deploy to the global cluster and do end-to-end testing with other components without replicating or mocking up dependencies.

As shown in figure 4-9, the most differentiating feature in Azure Dev Spaces is the capability of creating 'spaces' that can run integrated to the rest of the global deployment in the cluster:

![Diagram showing the use of multiple spaces in Azure Dev Spaces.](./media/orchestrate-high-scalability-availability/use-multiple-spaces-azure-dev.png)

**Figure 4-9**. Using multiple spaces in Azure Dev Spaces

Azure Dev Spaces can transparently mix and match production microservices with development container instance, to ease testing of new versions. Basically, you can set up a shared dev space in Azure. Each developer can focus on just their part of the application, and can iteratively develop "pre-committed" code in a dev space that already contains all the other services and cloud resources that their scenarios depend on. Dependencies are always up-to-date, and developers are working in a way that mirrors production.

Azure Dev Spaces provides the concept of a space, which allows you to work in isolation and without the fear of breaking your team members. This feature is based on URL prefixes; if you use a dev space prefix in the URL for a container's request, Azure Dev Spaces runs a special version of the container that it deployed for that space, if one exists. Otherwise, it will run the global/consolidated version.

For a concrete example, see the [eShopOnContainers wiki page on Azure Dev Spaces](https://github.com/dotnet-architecture/eShopOnContainers/wiki/Azure-Dev-Spaces).

For further information, see [Team Development with Azure Dev Spaces](/azure/dev-spaces/team-development-netcore).

## Additional resources

- **Getting started with Azure Kubernetes Service (AKS)** \
[https://docs.microsoft.com/azure/aks/kubernetes-walkthrough-portal](/azure/aks/kubernetes-walkthrough-portal)

- **Azure Dev Spaces** \
[https://docs.microsoft.com/azure/dev-spaces/azure-dev-spaces](/azure/dev-spaces/azure-dev-spaces)

- **Kubernetes.** The official site. \
<https://kubernetes.io/>

Expand Down
Loading

0 comments on commit d6bed51

Please sign in to comment.