

In this step, Visual Studio will offer to create a Dockerfile. Choose Docker Compose, and then select the same target OS. In the Web API project, again right-click on the project node, and choose Add > Container Orchestrator Support. You can see the command-line tool docker-compose is used to configure and create the runtime containers. Look at the Container Tools section of the output pane for details of the commands being run. These files are generally associated with the development environment and source control, not part of the app or service you're developing. dockerignore file contains file types and extensions that you don't want Docker to include in the container. The docker-compose.yml appears as follows: version: '3.4' dockerignore file in the docker-compose node in the solution, and that project shows in boldface font, which shows that it's the startup project. Visual Studio creates a docker-compose.yml file and a. The Docker Support Options dialog appears.Ĭhoose your Target OS, for example, Linux. In the WebFrontEnd project, choose Add > Container Orchestrator Support.
Docker run image with multiple port code#
However, you need to comment out the call to UseHttpsRedirection in the Web API project, because this code uses HTTP, not HTTPS, to call the Web API.

NET Core 3.1 and later, you don't need this, because you can use the WeatherForecast API that is already there. Learn about building Web apps with ASP.NET 2.x only) Now in the Web API project, add code to the Values controller to customize the message returned by the API for the call you added from webfrontend. In the Index.cshtml file, add a line to display ViewData so that the file looks like the following code: = "Home page" For best practices, see Use HttpClientFactory to implement resilient HTTP requests. In real-world code, you shouldn't dispose HttpClient after every request.
