Running .Net Core console app in docker container on Linux App Service

  .net-core, azure, azure-web-app-service, c#, docker


I have a .NET Core 3.1 console application that is a long running process. Basically, some logic running in an infinite loop with a delay each loop.

I’m currently using Visual Studio to package this app up in a docker container and then deploy to a Linux App Service in Azure. This all works. I’m able to publish the docker container to an Azure Container Registry, and then point my Linux App Service to the container. The container starts up successfully, and I’m able to see some console output from my app in the logs displayed in Azure. So, all good? Not quite!

(I know this is generally something you could use a WebJob for (sans containers), but Linux App Services don’t support WebJobs yet.)


The Azure App Service seems to ping my container by default on port 80 to check if my app has started up successfully. But, it’s a console app, not a web/asp application. So, understandably, Azure gives me the following error:

2021-01-22T02:12:24.506Z ERROR - Container for site <sitename> did not start within expected time limit. Elapsed time = 230.4560202 sec
2021-01-22T02:12:24.508Z ERROR - Container didnt respond to HTTP pings on port: 80, failing site start. See container logs for debugging.
2021-01-22T02:12:24.553Z INFO  - Stopping site because it failed during startup.

Is there any way to get around this? And no, it can’t currently be a Window App Service with a WebJob.

Source: Docker Questions