Streamlit doesn't reload site when code in container changes

I’m running my streamlit app inside debian docker container on prod and debugging on Windows locally. I created config.toml which I put inside .streamlit folder located in workdir. It’s content:

[server]
runOnSave = true
headless = true
maxUploadSize = 2000

[browser]
gatherUsageStats = false

When I run the app locally, it automatically reloads when code changes are made. But when it runs from container, it doesn’t. This is my dockefile:

# syntax=docker/dockerfile:1
FROM python:3.10-slim-bookworm
RUN apt-get update && apt-get install -y \
    ffmpeg libsm6 libxext6
WORKDIR /app
COPY Pipfile* .
RUN pip install --no-cache-dir pipenv && \
     pipenv install --system --deploy --clear
COPY /app .
VOLUME /app
ENTRYPOINT ["streamlit", "run", "src/main.py"]
EXPOSE 8501

And docker-compose.yml:

services:
  app:
    build: .
    ports:
      - 80:8501
    volumes:
      - ./app:/app

I make changes locally and volume transfer updated files to container. I can see updated files in container’s files panel through docker desktop.
Could you tell, please, why it doesn’t automatically reload?

1 Like

I’m also experiencing the same issue. My streamlit app dosent update when my main.py file changes while running a docker image & container. How can this issue be fixed? It takes a long time to rebuild docker each time I want to see the changes go live on streamlit

1 Like

config.toml

# this is needed for local development with docker
[server]
# if you don't want to start the default browser:
headless = true
# you will need this for local development:
runOnSave = true
# you will need this if running docker on windows host:
fileWatcherType = "poll"
6 Likes

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