Streamlit-App on Azure Web App for Container (with Docker) gives just a "Please Wait..." message

Hello everyone,

Iā€™m having trouble deploying a Streamlit app as a Docker image to an Azure Web App. I keep getting a message saying ā€œPlease Waitā€¦ā€, even though Streamlit should only display a heading (which I tried for testing purposes).

Iā€™ve done an extensive internet search and read a lot about it, but I havenā€™t found a consistent approach to fix this issue, so nothing has worked so far.

Hereā€™s a brief overview:

  • Itā€™s a Python 3.10 application.
  • The Docker container works locally.
  • Iā€™ve created an Azure Container Registry (with basic pricing) and pushed the local Docker image there.
  • An Azure Web App for Containers has been created (with B1 pricing and the Docker image previously created in ACR; unfortunately, thereā€™s no SSH option included, at least according to the settings).
  • Additionally, Iā€™ve set the environment variable WEBSITES_PORT=8501 (which is also set in the Dockerfile with ā€œEXPOSE 8501ā€).

Iā€™ve tried adjusting some settings in Streamlit (server.address=ā€œ0.0.0.0ā€, server.folderWatchBlacklist=, server.enableCORS=false, server.enableXrsfProtection=false, server.enableWebsocketCompression=false) and on the Azure Web App side (set ā€œAlways Onā€ to True), but unfortunately, everything has been unsuccessful.

Iā€™m at a loss for what to do next and would appreciate any help.

Thank you very much and best regards,

Mario

Dockerfile:

# Use Python 3.10 base image

FROM python:3.10


# Set the working directory in the Docker container

WORKDIR /app
 

# Copy the contents of the 'src', 'assets', and 'documents' directories to the Docker container

COPY src/ ./
 

# Install Python dependencies

RUN pip install -r requirements.txt

# Expose the port Streamlit runs on

EXPOSE 8501
 

# Command to run the app

CMD ["streamlit", "run", "main.py"]

Hi, I was having similar issue. resolved by giving this custom command

python -m streamlit run app.py --server.port 8000 --server.address 0.0.0.0 --server.enableCORS=false --server.enableXsrfProtection=false

Disabling CORS worked for me but it was giving a warning that it is not compatible with XsrfProtection=true hence turned it off too. I am looking for its implications now.

Hi, i had to enable Websockets for the Web Apps domain in our company network. Then it worked for us.