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.

Hi @prtkp @Mario2712 , my docker file is below
image

also in configuration i put this line in Azure Web App
image

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

But app is not opening for me.

As i’m new to this any help will be thankfull.

If you are passing streamlit run app.py in CMD then I think you don’t need the same command in configuration-> startup command

  1. You can try adding both flag setting in CMD only (and make startup command empty)
    Or
  2. Don’t put anything in CMD, use startup command as you have shown.

Let me know if this doesn’t work. Also have you put any network restrictions on webapp ?

Hi @prtkp , thanks for reply.

There are some more thing wanted to know my docker file is this now


when i try to run docker locally by default it uses 8501
image
on opening in browser it shows can’t reach
image

And also facing issue while uploading container to Azure container registry,

Any help will be thankful.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.