Hi @Prabuddha Chatterjee ,
Welcome to MS Q&A platform.
If your Azure Web App (Docker Compose - Preview) is stuck in a restart loop, it’s probably because Azure’s container monitoring system is detecting issues and restarting the service automatically. This can happen for a few reasons, like health check failures where Azure pings your container to see if it’s running properly. If the response is off or slow, Azure might think the container is unhealthy and restart it. Another reason could be incorrect port configuration—Azure expects your container to listen on port 80, so if your app runs on something like 3000 or 5000, you need to set the WEBSITES_PORT environment variable in Azure. Also, insufficient resources can cause instability, especially if you’re using a B1 App Service Plan with limited CPU and memory. If your container needs more resources, it might keep crashing and restarting. Upgrading to an S1 or P1V2 plan could help. Lastly, startup script failures might be the culprit if a misconfigured or failing startup command is preventing proper initialization.
To fix this, start by checking Azure logs (az webapp log tail --name )
to find specific errors causing the restarts. Verify your health check configuration in docker-compose.yml
or try disabling health checks temporarily. Make sure your app exposes the correct port and the WEBSITES_PORT
setting matches it. If you suspect resource limitations, scale up your App Service Plan for more CPU and memory. Finally, if you use a custom startup script, test it locally to ensure it runs without errors before deploying. These steps should help stabilize your web app and stop the restarts.
Also, as per Microsoft’s official blog, Azure Web App for Containers keeps pinging the container over HTTP and expects a valid response. If the container doesn't respond in time or is listening on the wrong port, Azure marks it as unhealthy and restarts it. To fix this, make sure your app handles HTTP requests correctly and the right port is exposed using the WEBSITES_PORT setting in Azure App Service.
You can refer to similar issues discussed in Microsoft Q&A, Stack Overflow, and other Azure documentation.
Let us know if you need any further assistance!
If the answer is helpful, please click Accept Answer and kindly upvote it so that other people who faces similar issue may get benefitted from it.