How to deploy custom docker image (blazor server webapp) from ACR to Azure App Service with azure cli?

Siegfried Heintze 1,906 Reputation points
2022-12-22T21:46:55.913+00:00

I had a similar problem with deploying my custom dockerhub image to App Service WebApp and now I can no longer reproduce that problem because it was working fine when I checked it recently... Maybe I'll check it again today...

For this post I'm using azure container registry (ACR) instead of docker hub and this time I have the logs... I have successfully created an ACR registry and a free linux AppService plan.

Below (scroll down a long ways) is the log from doing the docker build and deployment with "az webapp create". Please guide me in diagnosing this problem.

Now I am getting this:

273379-image.png

So I click on the link and that takes me to the portal.

I could not find anything useful in any of these links:

273368-image.png

OK, maybe we have some clues here in the portal log stream? Nope:

2022-12-22T22:39:54  Welcome, you are now connected to log-streaming service.  
2022-12-22T22:39:55  Welcome, you are now connected to log-streaming service.  
2022-12-22T22:39:56  Welcome, you are now connected to log-streaming service.  
2022-12-22T22:39:57  Welcome, you are now connected to log-streaming service.  
2022-12-22T22:39:58  Welcome, you are now connected to log-streaming service.  
2022-12-22T22:39:59  Welcome, you are now connected to log-streaming service.  
2022-12-22T22:39:59  Welcome, you are now connected to log-streaming service.  
2022-12-22T22:39:59  Welcome, you are now connected to log-streaming service.  
2022-12-22T22:39:59  Welcome, you are now connected to log-streaming service.  
2022-12-22T22:39:59  Welcome, you are now connected to log-streaming service.  

------LOG from DOCKER BUILD & AZ WEBAPP CREATE--------------------------------------------------------

docker build -t imagedemovisualstudiocicdforblazorserver .  
#1 [internal] load build definition from Dockerfile  
#1 sha256:988056374fdb84a0e5a758adf6ff226bad34f93619640f6e3751bc9200c0fe84  
#1 transferring dockerfile: 32B 0.0s done  
#1 DONE 0.1s  
  
#2 [internal] load .dockerignore  
#2 sha256:2271c5734bfd28e1c00a79186fd43225e14854a3932cf56c8bdef7aff0d9cf2a  
#2 transferring context: 35B done  
#2 DONE 0.0s  
  
#4 [internal] load metadata for mcr.microsoft.com/dotnet/aspnet:6.0  
#4 sha256:ac4494cbca04ddb415c76edcbcc7688784c2a6ea65dd656286c013738aa3b75f  
#4 DONE 0.0s  
  
#3 [internal] load metadata for mcr.microsoft.com/dotnet/sdk:6.0  
#3 sha256:9eb4f6c3944cfcbfe18b9f1a753c769fc35341309a8d4a21f8937f47e94c712b  
#3 DONE 0.2s  
  
#8 [build 1/7] FROM mcr.microsoft.com/dotnet/sdk:6.0@sha256:700773b3f6a2094e1a063d17cb2fa1f0e2081b118936268238ab0f788cdcefcf  
#8 sha256:4b4537d3b42509a900ce970c4a0adb4081f9ba70fcee658bf445e44d5f0312f0  
#8 DONE 0.0s  
  
#5 [base 1/2] FROM mcr.microsoft.com/dotnet/aspnet:6.0  
#5 sha256:50f1ddc10932c4a74c7af5704e931a9489c710faea4f2381fe2380827a900e00  
#5 DONE 0.0s  
  
#10 [internal] load build context  
#10 sha256:0edc19c9849faaa48b9ef9ae82dd3ddac95e7deca56937c6a97f561b83e69026  
#10 transferring context: 17.18kB 0.1s done  
#10 DONE 0.1s  
  
#9 [build 2/7] WORKDIR /src  
#9 sha256:2e2e31bb978aaee8d59788f5896bc16ba7ffa85976ea3f925085a06b4a201de0  
#9 CACHED  
  
#11 [build 3/7] COPY [DemoVisualStudioCICDForBlazorServer.csproj, .]  
#11 sha256:a97cba0e5042e411cb0656a9415f147f74f1d882ed929cfa4533fd41a3756b7f  
#11 CACHED  
  
#12 [build 4/7] RUN dotnet restore "./DemoVisualStudioCICDForBlazorServer.csproj"  
#12 sha256:a1c1e18e5276289b56788e4fc4d6c39e39af83e9436170fa23071c4a878020ed  
#12 CACHED  
  
#13 [build 5/7] COPY . .  
#13 sha256:88b44af2cae6b1c1ba7c376ec2050c4498d97bc9a64bdbd77f2202f708fbdf1a  
#13 DONE 0.1s  
  
#14 [build 6/7] WORKDIR /src/.  
#14 sha256:c5dc803f217fad1ebec76373ebb924f17b27b57e75055a497106cd0a3869d34a  
#14 DONE 0.1s  
  
#15 [build 7/7] RUN dotnet build "DemoVisualStudioCICDForBlazorServer.csproj" -c Release -o /app/build  
#15 sha256:5cfac106a1c117d6397e0791aee1713ad3b11c4046b85237b738438c10b9d676  
#15 0.828 MSBuild version 17.3.2+561848881 for .NET  
#15 1.158   Determining projects to restore...  
#15 1.440   All projects are up-to-date for restore.  
#15 3.979   DemoVisualStudioCICDForBlazorServer -> /app/build/DemoVisualStudioCICDForBlazorServer.dll  
#15 3.987   
#15 3.987 Build succeeded.  
#15 3.987     0 Warning(s)  
#15 3.987     0 Error(s)  
#15 3.987   
#15 3.987 Time Elapsed 00:00:03.11  
#15 DONE 4.0s  
  
#16 [publish 1/1] RUN dotnet publish "DemoVisualStudioCICDForBlazorServer.csproj" -c Release -o /app/publish  
#16 sha256:b95bd1c1a4445bc74d35fbdaf39bec82f377794a63ddc8e69d72886eb7fdd7ee  
#16 1.363 MSBuild version 17.3.2+561848881 for .NET  
#16 1.822   Determining projects to restore...  
#16 2.048   All projects are up-to-date for restore.  
#16 2.429   DemoVisualStudioCICDForBlazorServer -> /src/bin/Release/net6.0/DemoVisualStudioCICDForBlazorServer.dll  
#16 2.459   DemoVisualStudioCICDForBlazorServer -> /app/publish/  
#16 DONE 2.5s  
  
#6 [base 2/2] WORKDIR /app  
#6 sha256:bc3cf6c390e5fe0e66017b4845c8fcf3e56c7adac9f514a00c2c986024f377a4  
#6 CACHED  
  
#7 [final 1/2] WORKDIR /app  
#7 sha256:3baba3edbb555769ad9a49e827de88d7dcc4f72ad6e2b42e576964e4a30eac96  
#7 CACHED  
  
#17 [final 2/2] COPY --from=publish /app/publish .  
#17 sha256:902884717dec0c0640d4855166b08f953e3785282cac95e1c0723a9fa873d6ae  
#17 CACHED  
  
#18 exporting to image  
#18 sha256:e8c613e07b0b7ff33893b694f7759a10d42e180f2b4dc349fb57dc6b71dcab00  
#18 exporting layers done  
#18 writing image sha256:57189f997834df7359f72c5d98c5818767fa0d92e2afdbcba243f74d7561903b done  
#18 naming to docker.io/library/imagedemovisualstudiocicdforblazorserver done  
#18 DONE 0.0s  
  
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them  
Login Succeeded  
az acr login -n demovisualstudiocicdforblazorserver -u demovisualstudiocicdforblazorserver -p abcdefghijklmnopqrstuvwxyz  
Login Succeeded  
docker login demovisualstudiocicdforblazorserver.azurecr.io  
docker push demovisualstudiocicdforblazorserver.azurecr.io/imagedemovisualstudiocicdforblazorserver:latest  
The push refers to repository [demovisualstudiocicdforblazorserver.azurecr.io/imagedemovisualstudiocicdforblazorserver]  
ba5a93f9b1d1: Preparing  
5f70bf18a086: Preparing  
e82ced553cfc: Preparing  
fc47b3bbb3a5: Preparing  
4b7415c5302b: Preparing  
8407279d92ac: Preparing  
48b03e1004df: Preparing  
ec4a38999118: Preparing  
8407279d92ac: Waiting  
48b03e1004df: Waiting  
ec4a38999118: Waiting  
4b7415c5302b: Pushed  
5f70bf18a086: Pushed  
e82ced553cfc: Pushed  
ba5a93f9b1d1: Pushed  
fc47b3bbb3a5: Pushed  
48b03e1004df: Pushed  
8407279d92ac: Pushed  
ec4a38999118: Pushed  
latest: digest: sha256:902a91402c8402fe3f3c4e44136a1810779d15f13ef828a405c7bdba43b2beb1 size: 1994  
[  
  "imagedemovisualstudiocicdforblazorserver"  
]  
{  
  "elasticScaleEnabled": false,  
  "extendedLocation": null,  
  "freeOfferExpirationTime": null,  
  "geoRegion": "West US",  
  "hostingEnvironmentProfile": null,  
  "hyperV": false,  
  "id": "/subscriptions/acc--REDACTED--bc27db/resourceGroups/rg_DemoVisualStudioCICDForBlazorServer/providers/Microsoft.Web/serverfarms/2j6dkjc5s4m4q-plan",  
  "isSpot": false,  
  "isXenon": false,  
  "kind": "linux",  
  "kubeEnvironmentProfile": null,  
  "location": "westus",  
  "maximumElasticWorkerCount": 1,  
  "maximumNumberOfWorkers": 1,  
  "name": "2j6dkjc5s4m4q-plan",  
  "numberOfSites": 0,  
  "numberOfWorkers": 1,  
  "perSiteScaling": false,  
  "provisioningState": "Succeeded",  
  "reserved": true,  
  "resourceGroup": "rg_DemoVisualStudioCICDForBlazorServer",  
  "sku": {  
    "capabilities": null,  
    "capacity": 1,  
    "family": "F",  
    "locations": null,  
    "name": "F1",  
    "size": "F1",  
    "skuCapacity": null,  
    "tier": "Free"  
  },  
  "spotExpirationTime": null,  
  "status": "Ready",  
  "subscription": "acc--REDACTED--27db",  
  "tags": null,  
  "targetWorkerCount": 0,  
  "targetWorkerSizeId": 0,  
  "type": "Microsoft.Web/serverfarms",  
  "workerTierName": null,  
  "zoneRedundant": false  
}  
  
az webapp create --name 2j6dkjc5s4m4q-web --resource-group rg_DemoVisualStudioCICDForBlazorServer --plan 2j6dkjc5s4m4q-plan --deployment-container-image-name demovisualstudiocicdforblazorserver.azurecr.io/sample/imagedemovisualstudiocicdforblazorserver:latest  
{  
  "availabilityState": "Normal",  
  "clientAffinityEnabled": true,  
  "clientCertEnabled": false,  
  "clientCertExclusionPaths": null,  
  "clientCertMode": "Required",  
  "cloningInfo": null,  
  "containerSize": 0,  
  "customDomainVerificationId": "REDACTED",  
  "dailyMemoryTimeQuota": 0,  
  "defaultHostName": "2j6dkjc5s4m4q-web.azurewebsites.net",  
  "enabled": true,  
  "enabledHostNames": [  
    "2j6dkjc5s4m4q-web.azurewebsites.net",  
    "2j6dkjc5s4m4q-web.scm.azurewebsites.net"  
  ],  
  "extendedLocation": null,  
  "ftpPublishingUrl": "ftp://waws-REDACTED.ftp.azurewebsites.windows.net/site/wwwroot",  
  "hostNameSslStates": [  
    {  
      "hostType": "Standard",  
      "ipBasedSslResult": null,  
      "ipBasedSslState": "NotConfigured",  
      "name": "2j6dkjc5s4m4q-web.azurewebsites.net",  
      "sslState": "Disabled",  
      "thumbprint": null,  
      "toUpdate": null,  
      "toUpdateIpBasedSsl": null,  
      "virtualIp": null  
    },  
    {  
      "hostType": "Repository",  
      "ipBasedSslResult": null,  
      "ipBasedSslState": "NotConfigured",  
      "name": "2j6dkjc5s4m4q-web.scm.azurewebsites.net",  
      "sslState": "Disabled",  
      "thumbprint": null,  
      "toUpdate": null,  
      "toUpdateIpBasedSsl": null,  
      "virtualIp": null  
    }  
  ],  
  "hostNames": [  
    "2j6dkjc5s4m4q-web.azurewebsites.net"  
  ],  
  "hostNamesDisabled": false,  
  "hostingEnvironmentProfile": null,  
  "httpsOnly": false,  
  "hyperV": false,  
  "id": "/subscriptions/acc2-REDACTED-27db/resourceGroups/rg_DemoVisualStudioCICDForBlazorServer/providers/Microsoft.Web/sites/2j6dkjc5s4m4q-web",  
  "identity": null,  
  "inProgressOperationId": null,  
  "isDefaultContainer": null,  
  "isXenon": false,  
  "keyVaultReferenceIdentity": "SystemAssigned",  
  "kind": "app,linux,container",  
  "lastModifiedTimeUtc": "2022-12-22T22:35:01.463333",  
  "location": "West US",  
  "maxNumberOfWorkers": null,  
  "name": "2j6dkjc5s4m4q-web",  
  "outboundIpAddresses": "20.237.250.92,20.237.250.103,20.237.250.117,20.237.250.145,20.237.250.155,20.237.250.224,40.112.243.103",  
  "possibleOutboundIpAddresses": "20.237.250.92,20.237.250.103,20.237.250.117,20.237.250.145,20.237.250.155,20.237.250.224,20.237.250.71,20.237.251.43,20.237.251.54,20.237.251.56,20.237.250.68,20.237.251.71,20.237.251.140,20.237.251.151,20.237.251.35,20.237.251.98,20.237.251.209,20.237.251.179,20.237.252.48,20.237.252.108,20.237.252.129,20.237.252.162,20.237.249.220,20.237.251.162,40.112.243.103",  
  "publicNetworkAccess": null,  
  "redundancyMode": "None",  
  "repositorySiteName": "2j6dkjc5s4m4q-web",  
  "reserved": true,  
  "resourceGroup": "rg_DemoVisualStudioCICDForBlazorServer",  
  "scmSiteAlsoStopped": false,  
  "serverFarmId": "/subscriptions/acc2-REDACTED-27db/resourceGroups/rg_DemoVisualStudioCICDForBlazorServer/providers/Microsoft.Web/serverfarms/2j6dkjc5s4m4q-plan",  
  "siteConfig": {  
    "acrUseManagedIdentityCreds": false,  
    "acrUserManagedIdentityId": null,  
    "alwaysOn": false,  
    "antivirusScanEnabled": null,  
    "apiDefinition": null,  
    "apiManagementConfig": null,  
    "appCommandLine": null,  
    "appSettings": null,  
    "autoHealEnabled": null,  
    "autoHealRules": null,  
    "autoSwapSlotName": null,  
    "azureMonitorLogCategories": null,  
    "azureStorageAccounts": null,  
    "connectionStrings": null,  
    "cors": null,  
    "customAppPoolIdentityAdminState": null,  
    "customAppPoolIdentityTenantState": null,  
    "defaultDocuments": null,  
    "detailedErrorLoggingEnabled": null,  
    "documentRoot": null,  
    "elasticWebAppScaleLimit": 0,  
    "experiments": null,  
    "fileChangeAuditEnabled": null,  
    "ftpsState": null,  
    "functionAppScaleLimit": null,  
    "functionsRuntimeScaleMonitoringEnabled": null,  
    "handlerMappings": null,  
    "healthCheckPath": null,  
    "http20Enabled": false,  
    "http20ProxyFlag": null,  
    "httpLoggingEnabled": null,  
    "ipSecurityRestrictions": [  
      {  
        "action": "Allow",  
        "description": "Allow all access",  
        "headers": null,  
        "ipAddress": "Any",  
        "name": "Allow all",  
        "priority": 2147483647,  
        "subnetMask": null,  
        "subnetTrafficTag": null,  
        "tag": null,  
        "vnetSubnetResourceId": null,  
        "vnetTrafficTag": null  
      }  
    ],  
    "ipSecurityRestrictionsDefaultAction": null,  
    "javaContainer": null,  
    "javaContainerVersion": null,  
    "javaVersion": null,  
    "keyVaultReferenceIdentity": null,  
    "limits": null,  
    "linuxFxVersion": "",  
    "loadBalancing": null,  
    "localMySqlEnabled": null,  
    "logsDirectorySizeLimit": null,  
    "machineKey": null,  
    "managedPipelineMode": null,  
    "managedServiceIdentityId": null,  
    "metadata": null,  
    "minTlsCipherSuite": null,  
    "minTlsVersion": null,  
    "minimumElasticInstanceCount": 0,  
    "netFrameworkVersion": null,  
    "nodeVersion": null,  
    "numberOfWorkers": 1,  
    "phpVersion": null,  
    "powerShellVersion": null,  
    "preWarmedInstanceCount": null,  
    "publicNetworkAccess": null,  
    "publishingPassword": null,  
    "publishingUsername": null,  
    "push": null,  
    "pythonVersion": null,  
    "remoteDebuggingEnabled": null,  
    "remoteDebuggingVersion": null,  
    "requestTracingEnabled": null,  
    "requestTracingExpirationTime": null,  
    "routingRules": null,  
    "runtimeADUser": null,  
    "runtimeADUserPassword": null,  
    "scmIpSecurityRestrictions": [  
      {  
        "action": "Allow",  
        "description": "Allow all access",  
        "headers": null,  
        "ipAddress": "Any",  
        "name": "Allow all",  
        "priority": 2147483647,  
        "subnetMask": null,  
        "subnetTrafficTag": null,  
        "tag": null,  
        "vnetSubnetResourceId": null,  
        "vnetTrafficTag": null  
      }  
    ],  
    "scmIpSecurityRestrictionsDefaultAction": null,  
    "scmIpSecurityRestrictionsUseMain": null,  
    "scmMinTlsVersion": null,  
    "scmType": null,  
    "sitePort": null,  
    "storageType": null,  
    "supportedTlsCipherSuites": null,  
    "tracingOptions": null,  
    "use32BitWorkerProcess": null,  
    "virtualApplications": null,  
    "vnetName": null,  
    "vnetPrivatePortsCount": null,  
    "vnetRouteAllEnabled": null,  
    "webSocketsEnabled": null,  
    "websiteTimeZone": null,  
    "winAuthAdminState": null,  
    "winAuthTenantState": null,  
    "windowsConfiguredStacks": null,  
    "windowsFxVersion": null,  
    "xManagedServiceIdentityId": null  
  },  
  "slotSwapStatus": null,  
  "state": "Running",  
  "storageAccountRequired": false,  
  "suspendedTill": null,  
  "tags": null,  
  "targetSwapSlot": null,  
  "trafficManagerHostNames": null,  
  "type": "Microsoft.Web/sites",  
  "usageState": "Normal",  
  "virtualNetworkSubnetId": null,  
  "vnetContentShareEnabled": false,  
  "vnetImagePullEnabled": false,  
  "vnetRouteAllEnabled": false  
}  
az resource list -g $rg --query "[?resourceGroup=='$rg'].{ name: name, flavor: kind, resourceType: type, region: location }" --output table  
Name                                 ResourceType                            Region    Flavor  
-----------------------------------  --------------------------------------  --------  -------------------  
demovisualstudiocicdforblazorserver  Microsoft.ContainerRegistry/registries  westus  
2j6dkjc5s4m4q-plan                   Microsoft.Web/serverFarms               westus    linux  
2j6dkjc5s4m4q-web                    Microsoft.Web/sites                     westus    app,linux,container  
  
Compilation finished at Thu Dec 22 14:35:28  
Azure Container Registry
Azure Container Registry
An Azure service that provides a registry of Docker and Open Container Initiative images.
508 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ryan Hill 30,281 Reputation points Microsoft Employee Moderator
    2022-12-23T07:16:51.347+00:00

    Hi @Siegfried Heintze ,

    So unfortunately, I don't see a reason for your issue. Normally, the browser screen you're getting indicates the docker image you pulled from your registry failed to start and the platform couldn't bind to a port for HTTP traffic.

    What you're seeing from the Log Stream blade tells me you opened the screen after application startup, i.e. you missed the error. To see it, just run az webapp restart --name 2j6dkjc5s4m4q-web and have that blade open. You should log messages indicating your image is being pulled from your registry, a docker run -d command and error indicating the image failed to start.

    The prior step normally won't have enough details about why your container failed, only that it did. For those details, open https:// 2j6dkjc5s4m4q-web.scm.azurewebsites.net/api/logs/docker navigate to the log file ending in _default_docker.log. This should contain any startup failures your image had.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.