Getting started integrating with Docker containers in Visual Studio for Mac Overview Microsoft offers great support for building apps deployed to Docker containers in Visual Studio for Mac, that can be easily deployed and managed in Azure. With the power of the cloud behind your solution, you can easily compose powerful constellations of these containers known as 'microservices' that are independently managed and scaled. In this hands-on lab you will create a microservices solution that employs two ASP.NET Core apps hosted in separate Docker containers. Objectives • Create an ASP.NET Core web site • Deploy the site in a Docker container • Create and integrate an ASP.NET Core web API project in a Docker container Prerequisites • Visual Studio for Mac () • Note that this lab currently requires in Visual Studio for Mac, as Docker support is available as a preview • Docker () Intended Audience This lab is intended for developers who are familiar with C# and ASP.NET, although deep experience is not required. Exercise 1: Getting started integrating with Docker containers in Visual Studio for Mac Task 1: Creating an ASP.NET Core web site and enabling it for Docker • Launch Visual Studio for Mac. The Mac's most popular audio program for many years, Sound Studio continues to be regularly updated to add new features and to take advantage of the very latest Apple technologies. • Select File > New Solution. • Select the.NET Core > Yamaha dm1000 studio manager mac. App category and the ASP.NET Core Web App template. Visual Studio Setup Git![]() • If presented with a Target Framework selection screen for.NET Core, select the target framework you want to use, such as.NET Core 1.1. • Enter a Project Name of 'DockerLab' and click Create. • The created project contains all the basics you need to build and run an ASP.NET Core web site. Now that you have Visual Studio and a Linux machine ready to go lets walk through getting a real open source C++ project working in Visual Studio targeting Windows and Linux. For this tutorial we are going to use the Bullet Physics SDK on GitHub. Connect to GitHub. Once you install the extension, you can log into your GitHub.com or GitHub Enterprise account in Visual Studio with full support for two-factor authentication. Visual Studio dev tools & services make app development easy for any platform & language. Try our Mac & Windows code editor, IDE, or VSTS for free. • In Solution Explorer, right-click the DockerLab project node and select Add > Add Docker Support. This will add a new Docker-specific project to the solution ( docker-compose), along with a Docker configuration file to the project. • Open the newly added Dockerfile from the DockerLab project. • Dockerfile describes the application, including the base container, the port number to expose the application on, the entry point of the application, and more. You can learn more about this format. • From the docker-compose project, open docker-compose.yml. ![]() • docker-compose.yml describes how the application should be composed of the required containers to set up a given solution. Right now, there's just one service for the DockerLab project created earlier. More will be added here as additional container apps become part of the solution. • Note that the docker-compose project has also become the default startup project. This makes it easy to launch multiple projects as part of the same debugging session. • Select Run > Start Debugging or press F5 to build, deploy, and run the project in a Docker container. This may take a minute or so to complete. • Once the application has launched in Safari, note that the URL is to the specific localhost port the container is listening on (it may vary from the screenshot below). • Open a new instance of Terminal. • Execute the command below to get a list of all Docker containers running. Docker ps • Unless you have other containers running, there should be only one. Note that the data wraps into three lines in the screenshot below. A key point of interest is the port relay that indicates that the container is listening on a given port (which should be the same as used by the browser above) and using port 80 to reach its internal web server. Github• If presented with a Target Framework selection screen for.NET Core, select the target framework you want to use, such as.NET Core 1.1. • Enter a project name of 'api' and click Create. • The project structure of the API project is similar to the web site project, except that it has fewer files since it doesn't need views or some of the client-side web components. It still uses MVC, so the Controllers folder is where the magic happens. • Right-click the api project node and select Add > Add Docker Support. This will run the same process as before, but will now merge new settings for this project alongside the existing settings for the DockerLab project.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |