Before we can use the sample services we created earlier and deploy them to Kubernetes, we must create Docker images for them and push them to a container registry. In our case, we will just push them to Docker Hub.
Let's start with the .NET Core sample:
- Locate the Program.cs file in the .NET project and open it.
- Modify the CreateHostBuilder method so it looks like this:
Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); webBuilder.UseUrls("http://*:5000"); });
- Add Dockerfile with the following content to the ch17/dotnet/sample-api project folder:
FROM mcr.microsoft.com/dotnet/core/aspnet:3.1 AS baseWORKDIR /appEXPOSE 5000FROM mcr.microsoft.com/dotnet/core/sdk:3.1 ...