Windows docker container with basic streamlit application exits automatically after start

Hi this is my python application

import streamlit as st
st.title(“My Simple Streamlit App”)
st.write(“Hello, world!”)

This is my Dockerfile:

FROM python:3.9.12
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD [“streamlit”, “run”, “”, “–server.port=8501”, “–server.address=”]

This is my requirements.txt:


I create the image with:

docker build -t example .

I create the Container with:

docker run -d -p 8501:8501 --name example_container example

Container gets greated and runs but after 3-4 seconds it exits automatically.
On Linux Containers works fine.

PD: docker log:

>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.


Any idea?


I have exactly the same problem on Windows. I haven’t been able to try on Linux unfortunately.


headless = true

to my config.toml fixed it!

1 Like

…or add --server.headless=true to the docker CMD