skip to Main Content

I have docker image that runs a basic streamlit app in it. But when I docker run the image the first time, it returns the streamlit welcome message which is shown below and the app doesn’t launch or move forward from this message without interacting with it.

 Welcome to Streamlit!

  If you’d like to receive helpful onboarding emails, news, offers, promotions,
  and the occasional swag, please enter your email address below. Otherwise,
  leave this field blank.
  
  Email: 

To move past this I need to attach a shell in vs code and then retype the command that I use in my docker file which is streamlit run app.py > NUL –server.port=8501 –server.address=0.0.0.0. After I do this the message appears again but I am able to just hit enter and move past it and then the app runs fine. However, I would like to avoid having to enter the container each time I start it and run the app again and hit enter.

I have included my docker file below as that is probably where the changes need to occur, I am just unsure what they should be. Not sure if it is a dockerfile solution or something I can fix with .streamlit/config.toml.

FROM python:latest

WORKDIR /app

COPY . .

RUN pip install -r requirements.txt

EXPOSE 8501

CMD ["streamlit", "run", "app.py", "> NUL", "--server.port=8501", "--server.address=0.0.0.0"]

I am using docker on a windows server btw.

2

Answers


  1. As described in this thread, you simply need to add the file ~/.streamlit/credentials.toml to your container.
    It needs to contain an entry for email:

    [general]
    email=""
    
    Login or Signup to reply.
  2. I met the same problem, try to edit the config file.

    # .streamlit/config.toml
    [server]
    headless = true
    

    How to run a containerized streamlit app in a headless/noninteractive mode?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search