Hello Rakesh,
Thank you for posting your question in the Microsoft Q&A forum.
The 504 timeout error when deploying your Docker image to Azure, despite it working locally, typically stems from resource constraints, networking issues, or misconfigured health probes. First, verify that your Azure App Service or Container Instance has sufficient CPU/memory allocated local performance doesn’t guarantee cloud scalability. Ensure your Dockerfile exposes the correct port (e.g., EXPOSE 80) and that Azure’s health probe settings match your app’s readiness endpoint (/health or similar).
Next, check networking dependencies: If your AI project calls external APIs or loads large models, Azure’s default egress timeouts (4 minutes) may be insufficient. Adjust these in your deployment template or use Azure Monitor to diagnose bottlenecks.
Lastly, review container logs via Azure’s Log Stream or CLI (az container logs) for startup errors. If the issue persists, test a simplified image (e.g., nginx) to isolate whether the problem lies with your app or the Azure environment. For deeper debugging, enable verbose logging in your application and redeploy.
If the above answer helped, please do not forget to "Accept Answer" as this may help other community members to refer the info if facing a similar issue. Your contribution to the Microsoft Q&A community is highly appreciated.