# Windows docker container with basic streamlit application exits automatically after start

**URL:** <https://discuss.streamlit.io/t/windows-docker-container-with-basic-streamlit-application-exits-automatically-after-start/69980>\
**Category:** Deployment\
**Tags:** debugging\
**Created:** [May 18, 2024, 12:57am UTC](https://discuss.streamlit.io/t/windows-docker-container-with-basic-streamlit-application-exits-automatically-after-start/69980 "2024-05-18T00:57:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Miguel\_Gonzalez](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/miguel_gonzalez/32/8384_2.png) [@Miguel\_Gonzalez](https://discuss.streamlit.io/u/Miguel_Gonzalez)\
**Post date:** [May 18, 2024, 12:57am UTC](https://discuss.streamlit.io/t/windows-docker-container-with-basic-streamlit-application-exits-automatically-after-start/69980/1 "2024-05-18T00:57:11Z")

</div>

Hi this is my python application app.py:

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

This is my Dockerfile:

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

This is my requirements.txt:

> streamlit

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.

  >Email:

```

Any idea?  
Thanks!

---

<div class="post-metadata">

**Author:** ![Emmanuel\_Pean](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/emmanuel_pean/32/48875_2.png) [@Emmanuel\_Pean](https://discuss.streamlit.io/u/Emmanuel_Pean)\
**Post date:** [May 22, 2024, 1:17pm UTC](https://discuss.streamlit.io/t/windows-docker-container-with-basic-streamlit-application-exits-automatically-after-start/69980/2 "2024-05-22T13:17:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Emmanuel\_Pean](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/emmanuel_pean/32/48875_2.png) [@Emmanuel\_Pean](https://discuss.streamlit.io/u/Emmanuel_Pean)\
**Post date:** [May 24, 2024, 10:33am UTC](https://discuss.streamlit.io/t/windows-docker-container-with-basic-streamlit-application-exits-automatically-after-start/69980/3 "2024-05-24T10:33:27Z")

</div>

Adding

```auto
[server]
headless = true

```

to my config.toml fixed it!

---

<div class="post-metadata">

**Author:** ![asehmi](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/asehmi/32/1771_2.png) [@asehmi](https://discuss.streamlit.io/u/asehmi)\
**Post date:** [May 29, 2024, 8:40pm UTC](https://discuss.streamlit.io/t/windows-docker-container-with-basic-streamlit-application-exits-automatically-after-start/69980/4 "2024-05-29T20:40:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/streamlit/original/3X/c/f/cf4c2ee0d938358f82448c5fe4b9c3c91d7ce19c.svg) [@system](https://discuss.streamlit.io/u/system)\
**Post date:** [November 25, 2024, 8:40pm UTC](https://discuss.streamlit.io/t/windows-docker-container-with-basic-streamlit-application-exits-automatically-after-start/69980/5 "2024-11-25T20:40:59Z")

</div>

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