I've been struggling for over a week to get a Windows container to run with an Azure App Service. My initial preference was to just use a standard container instance, but it appears that you only have the option of public or private networking, rather than custom (unlike with Linux containers). It looks like if you run your Windows container within an app service, you get the same networking options you get with other web sites. Azure support for Windows containers in App Services is nearly a year old, but relatively few resources address it, other than very basic scenarios.
My purpose in using a container is to run a third-party background Windows service on-demand without the overhead of a VM. Since it's using an app service, I decided to add an asp.net core rest endpoint for some status info. My container is based on mcr.microsoft.com/windows/servercore:ltsc2019
. I download and install .net and asp.net core (the base image has .net framework only), install my services, build and run the web site, then my entrypoint is a Powershell script that updates some config values and runs the asp.net core endpoint which manages the services.
If I use the portal, I can select the options for container vs code, Windows vs Linux, and get things to start with the basic quickstart image, but my own image in Azure Container Registry doesn't start properly. I'm using one of the supported base images, and it runs fine on my local machine. On Azure, it creates everything, but it never starts up. The small amount of logging indicates that it starts it up, mounts file share volumes, then basically just dies:
- Create container for image
- Attempting to start container
- Start container succeeded
- Container has started
- Call configure container utility
- Configure container utility completed
- Container has started
- Attempting to stop container
- Attempting to terminate container
- Attempting to remove container
- Container removed successfully
Also odd, even with the quickstart image, I don't see an actual Container Instance. Presumably this is because it's running in the App Service Plan directly, though none of that is very clear. From the web app, I can go to the App Service Plan (Windows Containers plan) where, under Apps, it shows a single app with type of "app,container,windows", but nowhere can I find access to view console logs or run a shell like I can with resources of type Container Image. In some screenshots I've come across, I can see a "Container Settings" link under "Settings" which I don't have, but perhaps that's only for Linux containers for some reason.
So, how should I be troubleshooting container issues when running within an app service? Am I missing something somewhere?