Azure container fails to configure and then 'terminated'

时间:2019-05-31 11:45:10

标签: azure docker azure-web-app-service

I have a Docker container with an ASP.NET (.NET 4.7) web application. The Docker image works perfectly using our local docker deployment, but will not start on Azure and I cannot find any information or diagnostics on why that might be.

From the log stream I get

31/05/2019 11:05:34.487 INFO - Site: ip-app-develop-1 - Creating container for image: 3tcsoftwaredockerdevelop.azurecr.io/irs-plus-app:latest-develop.
31/05/2019 11:05:34.516 INFO - Site: ip-app-develop-1 - Create container for image: 3tcsoftwaredockerdevelop.azurecr.io/irs-plus-app:latest-develop succeeded. Container Id 1ea16ee9f5f128f14246fefcd936705bb8a655dc6cdbce184fb11970ef7b1cc9
31/05/2019 11:05:40.151 INFO - Site: ip-app-develop-1 - Start container succeeded. Container: 1ea16ee9f5f128f14246fefcd936705bb8a655dc6cdbce184fb11970ef7b1cc9
31/05/2019 11:05:43.745 INFO - Site: ip-app-develop-1 - Application Logging (Filesystem): On
31/05/2019 11:05:44.919 INFO - Site: ip-app-develop-1 - Container ready
31/05/2019 11:05:44.919 INFO - Site: ip-app-develop-1 - Configuring container
31/05/2019 11:05:57.448 ERROR - Site: ip-app-develop-1 - Error configuring container
31/05/2019 11:06:02.455 INFO - Site: ip-app-develop-1 - Container has exited
31/05/2019 11:06:02.456 ERROR - Site: ip-app-develop-1 - Container customization failed
31/05/2019 11:06:02.470 INFO - Site: ip-app-develop-1 - Purging pending logs after stopping container
31/05/2019 11:06:02.456 INFO - Site: ip-app-develop-1 - Attempting to stop container: 1ea16ee9f5f128f14246fefcd936705bb8a655dc6cdbce184fb11970ef7b1cc9
31/05/2019 11:06:02.470 INFO - Site: ip-app-develop-1 - Container stopped successfully. Container Id: 1ea16ee9f5f128f14246fefcd936705bb8a655dc6cdbce184fb11970ef7b1cc9
31/05/2019 11:06:02.484 INFO - Site: ip-app-develop-1 - Purging after container failed to start

After several restart attempts (manual or as a result of re-configuration) I will simply get:

2019-05-31T10:33:46  The application was terminated.

The application then refuses to even attempt to start regardless of whether I use the az cli or the portal.

My current logging configuration is:

{
  "applicationLogs": {
    "azureBlobStorage": {
      "level": "Off",
      "retentionInDays": null,
      "sasUrl": null
    },
    "azureTableStorage": {
      "level": "Off",
      "sasUrl": null
    },
    "fileSystem": {
      "level": "Verbose"
    }
  },
  "detailedErrorMessages": {
    "enabled": true
  },
  "failedRequestsTracing": {
    "enabled": false
  },
  "httpLogs": {
    "azureBlobStorage": {
      "enabled": false,
      "retentionInDays": 2,
      "sasUrl": null
    },
    "fileSystem": {
      "enabled": true,
      "retentionInDays": 2,
      "retentionInMb": 35
    }
  },
  "id": "/subscriptions/XXX/resourceGroups/XXX/providers/Microsoft.Web/sites/XXX/config/logs",
  "kind": null,
  "location": "North Europe",
  "name": "logs",
  "resourceGroup": "XXX",
  "type": "Microsoft.Web/sites/config"
}

Further info on the app: - deployed using a docker container - docker base image mcr.microsoft.com/dotnet/framework/aspnet:4.7.2 - image entrypoint c:\ServiceMonitor.exe w3svc - app developed in ASP.NET 4.7 - using IIS as a web server

Questions:

How can I get some diagnostics on what is going on to enable me to determine why the app is not starting?

Why does the app refuse to even attempt to restart after a few failed attempts?

1 个答案:

答案 0 :(得分:1)

我们遇到了同样的问题,最后我们看到 Appservice 正在挂载一个带有“特殊熟化”版本的 servicemonitor.exe 这个版本从 appservice 的后端读取事件。如果您更改 docker 映像以使用此版本的服务监视器将起作用。我们创建了一个小的 powershell 并从这里更改了入口点:

#WORKDIR /LogMonitor
SHELL ["C:\\LogMonitor\\LogMonitor.exe", "powershell.exe"]
# Start IIS Remote Management and monitor IIS 
ENTRYPOINT Start-Service WMSVC; C:/ServiceMonitor.exe w3svc;

为此:

   ENTRYPOINT ["C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe","-File","C:\\start-iis-environment.ps1"]

我们已经创建了这个 powershell,例如:

if (Test-Path -Path 'C:\AppService\Util\ServiceMonitor.exe' -PathType Leaf) {
   & C:\AppService\Util\ServiceMonitor.exe w3svc
}
else{
   & C:\ServiceMonitor.exe w3svc
}