0

EDIT: The solution was to set the startup command equal to the last command of my Docker file, which in my case was python app.py. This can be done either via the Azure Portal (go to your Azure Web App and then to Deployment Center), or by running:
az webapp config show --name my-first-app --resource-group ... --startup-file="python app.py"

Using Azure Pipelines, I now have a Docker image in my Azure Container Registry. Let's say the registry is called myfirstregistry, the image is called myfirstimage, and the tag is "8" (which I determined by running az acr repository show-tags -n myfirstregistry --repository myfirstimage).

I then deployed an Azure Web App using this command: az webapp create --name my-first-app --resource-group ... --plan ... --deployment-container-image-name myfirstregistry.azurecr.io/myfirstimage:latest

When I go to my Azure Web App using the Azure Portal, under Overview -> Properties -> Web app -> Container Image it indeed says myfirstregistry.azurecr.io/myfirstimage:8.

But when I go to my web app, my-first-app.azurewebsites.net, it says "Your web app is running and waiting for your content". It seems as if the Docker image isn't running (yet). What am I missing here?

5
  • Check the configuration of your web app to make sure that it is set up to run the Docker image. You can do this by going to your web app in the Azure Portal, clicking on "Configuration" under the "Settings" section, and checking the "DOCKER_CUSTOM_IMAGE_NAME" setting. Make sure that it is set to the correct image name and tag Commented Apr 19, 2024 at 6:53
  • In my Azure Portal the "Settings" tab looks a bit different, but under "Deployment Center" -> "Settings" -> "Registry Settings" the correct image and tag are selected. (I'm not even able to type whatever I want, it actually gives me the list of images in my registry and only allows me to select one of those.) Commented Apr 19, 2024 at 12:11
  • You may check the permissions on ACR and refer to this MS Doc for deploying a Docker image in Azure Web App. Commented Apr 22, 2024 at 6:00
  • It seems like the startup command is crucial in your case to ensure your application runs correctly on Azure Web Apps. This issue typically arises when Azure Web Apps do not correctly interpret how to start the container. If the last command in your Dockerfile is python app.py, you should explicitly set this as the startup command for your Azure Web App. Can you run this az webapp config set --name my-first-app --resource-group <your-resource-group> --startup-file "python app.py" and restart your Azure Web App to apply the changes. Commented May 3, 2024 at 8:53
  • Also you mentioned that the image tag is 8, but your creation command used :latest It's possible that the Docker image is not running yet. You can check the logs of the container to see if there are any errors. az webapp log tail --name my-first-app --resource-group <rgname> Commented May 3, 2024 at 9:09

1 Answer 1

0

First of all, make sure to check the docker image is running fine locally using docker run .

 docker run -it --rm -p 8443:8443 <imagename>

If you configure any networking rules, make sure to allow the same port in azure web app networking section.

It seems like the startup command is crucial in your case to ensure your application runs correctly on Azure Web Apps. This issue typically arises when Azure Web Apps do not correctly interpret how to start the container. If the last command in your Dockerfile is python app.py, you should explicitly set this as the startup command for your Azure Web App. You can do the same via CLI

az webapp config set --name kaaspwebappwithsql --resource-group <your-resource-group> --startup-file "python app.py"

or portal enter image description here

After setting the startup command, restart your Azure Web App to apply the changes.
Ensure that the container image is pointing to the correct version. You mentioned that the image tag is 8, but your creation command used :latest

az webapp create --name kaaspwebappwithsql  --resource-group <your-resource-group> --plan <your-plan> --deployment-container-image-name arkoacr.azurecr.io/kaaspwebappwithsql:latest

To align the versions, you should use the correct tag, either by updating the Web App's configuration or by explicitly pushing the desired version as latest in ACR.

enter image description here

You can monitor your webapp for further details and troubleshooting under monitor-> logs

enter image description here

References:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.