Score:0

Troubleshooting Windows container in Azure app service

cn flag

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

enter image description here

enter image description here

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.

enter image description here

So, how should I be troubleshooting container issues when running within an app service? Am I missing something somewhere?

Score:1
gb flag

Diagnostics

You can find valuable debugging information when you click on Diagnose & Solve Problems -> Container Initialization in Azure Web App for Containers.

Kudu

App Service comes with a debug console that you can use for debugging, exploring, uploading files, as well as JSON endpoints for getting information about your environment. This console is called the Kudu Console or the SCM Dashboard for your app.

You can access this dashboard by going to the link https://[Your app name].scm.azurewebsites.net/.

Some of the things that Kudu provides are:

  • environment settings for your application log stream diagnostic dump debug console in which you can run PowerShell cmdlets and basic DOS commands.

https://docs.microsoft.com/en-us/azure/app-service/troubleshoot-performance-degradation

cn flag
Thanks for responding. Container Initialization isn't an option. I see "Available and Performance, "Configuration and Management", "SSL and Domains", "Risk Assessments", and "Diagnostic Tools." Using the search box, nothing comes us for the word "container.' I can't use the Kudu remote execution console since the container won't start: "The container is not currently running. Please try again in few minutes. process [9888] terminated! Press ENTER to start a new cmd process." Should I be able to view the stdout messages generated from the dockerfile run?
cn flag
I've come across a few places in the log stream where it provides a bit more info: "Unable to start container. Error message: Cannot create a file when that file already exists" but it shows up after the sequence of creating, starting, stopping, etc so I'm not sure where it's actually happening.
kh flag
Note: If deployed to an ASE the Kudu URI will be `https://{YourAppName}.scm.{YourASEName}.appserviceenvironment.net/`
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.