Share via

Failed to run docker image on azure web app. The image is built and pushed by ADO to ACR

Hikmet 20 Reputation points
Apr 12, 2023, 10:39 AM

Dear All, Acronyms: Azure DevOps (ADO), Azure Container Registry (ACR), Azure Web App (AWA) I have the following docker image through which I run cosmosdb-manager app

FROM python:3.9.5

COPY . /app
WORKDIR /app

RUN pip install --upgrade pip --user
RUN pip install -r requirements.txt

EXPOSE 5000

CMD ["gunicorn","main:app","-w","10","-b","0.0.0.0:5000","--timeout","400"]

The image is built in ADO as follows (copied from ADO "view yaml")

steps:
- task: Docker@0
  displayName: 'Build an image'
  inputs:
    azureSubscription: 'XXXXXXX'
    azureContainerRegistry: '{"loginServer":"YYYYYY.azurecr.io", "id" : "ZZZZZ"}'
    dockerFile: 'apps/cosmosdb-manager/Dockerfile'
    imageName: 'cosmosdb-manager'

The image is built image is pushed to ACR as follows (copied from ADO "view yaml")

steps:
- task: Docker@0
  displayName: 'Push an image'
  inputs:
    azureSubscription: 'XXXXXXX'
    azureContainerRegistry: '{"loginServer":"YYYYYY.azurecr.io", "id" : "ZZZZZ"}'
    action: 'Push an image'
    imageName: 'cosmosdb-manager'

The container is deployed on Azure web app as follows (copied from ADO "view yaml")

steps:
- task: AzureWebAppContainer@1
  displayName: 'Azure Web App on Container Deploy: imagedb-web-app'
  inputs:
    azureSubscription: 'XXXXXXX'
    appName: 'imagedb-web-app'
    containers: 'cosmosdb-manager'

Notes:

  • The pipeline is successfully built.
  • The repository is recognized in ACR.
  • Identity/System assigned is activated in both ACR and AWA
  • Role assignments AcrPull and AcrPush to AWA are given by ACR

Once I click on Overview/Browse in AWA I recieve the following error:
User's image

Looking at the Log stream I receive the following User's image

User's image

Any support to solve my issue would be highly appreciated.

Azure Container Registry
Azure Container Registry
An Azure service that provides a registry of Docker and Open Container Initiative images.
484 questions
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,765 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,319 questions
0 comments No comments
{count} votes

Accepted answer
  1. Andriy Bilous 11,631 Reputation points MVP
    Apr 12, 2023, 11:15 AM

    Hello @Hikmet I see error on your Application Logs: "https://registry-1.docker.io/vz/libary/cosmos-db-manager... docker login denied"

    As your image is built and pushed to ACR, you should specify Azure ACR as Docker image source, and not only image name:

    steps:
    - task: AzureWebAppContainer@1
      displayName: 'Azure Web App on Container Deploy: imagedb-web-app'
      inputs:
        azureSubscription: 'XXXXXXX'
        appName: 'imagedb-web-app'
        containers: myregistry.azurecr.io/cosmosdb-manager
    
    

    Here is a link to documentation:
    https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/azure-web-app-container-v1?view=azure-pipelines

    1 person found this answer helpful.

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.