I resolved the issue by removing the 'Poetry run'. The container was running fine on the local machine but was only failing in the web app. I was using FastAPI with Poetry for managing Python dependencies. It seems like the Azure Web app has issues with 'Poetry run'.
This was the issue in my Docker
CMD ["poetry", "run", "python", "serve.py"]
I resolved the issue by exporting the dependencies to a requirements.txt file and performing a global pip install. I then ran the following commands to make it work
CMD ["python", "serve.py"]