I am very new to containerization. I have created a new .net core 3.1 rest api in visual studio using default template. I am not changing anything in default template. When I run it using F5, it runs fine in browser with url https://localhost:44332/weatherforecast. Now, I am trying to run it in docker container with the Dockerfile configuration below:
FROM mcr.microsoft.com/dotnet/aspnet:3.1
COPY bin/Release/netcoreapp3.1/publish App/
WORKDIR /App
EXPOSE 5000
EXPOSE 443
ENTRYPOINT ["dotnet", "CoreRestApi.dll"]
I am able to generate the docker image and the container. The container also get's started. But when I try to browse the url's as https://localhost/weatherforecast or http://localhost:5000/weatherforecast to access the api, it displays nothing.
The code for the Main method in application is as below:
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
The docker desktop displays the following:
Am I missing any step over here?
