Use the built-in Docker support in Visual Studio 2017 to add a Dockerfile and Docker Compose files to a .NET Core MVC web application, and then debug the application inside a Docker container.
- [Narrator] Let's take a look at how we can use Visual Studio to add Docker support to an existing application. Here we have a .NET Core web application open in Visual Studio 2017. Let's run the application outside of a Docker first and take a look at the output. You're going to press the debug button up here at the top. This application shows the current computer name and operating system. We'll see this information change when we run the application inside the container. Let's stop the debugger, and let's add Docker support to the application.
To add Docker support using Visual Studio, we'll right-click on the project file, go to add, and click Docker support. Now, to the right we can see that visual studio has added some docker composed files and has also added the Dockerfile. Let's use the new files to debug our application inside a container, and then we can take a closer look at how it all works. You'll notice at the top that the debug button has changed to say "Docker" instead of "IIS Express". This is because the Docker composed project is set as the default start-up project.
If we change this back to our regular project, you'll see it changes back to IIS here at the top. So, let's run this application in a container. Now that the application is running, you will see that the machine name has changed to be the ID of the Docker container, and the operating system has changed to Linux. Let's take a closer look at how all this works.
- Setting up your environment
- Adding Docker support to an application
- Debugging container-based apps in Visual Studio 2017
- The DevOps life cycle with Visual Studio and VS Team Services
- Configuring release and build
- Azure hosting options
- Using Kubernetes with Azure