We are deploying a streamlit app via docker and kubernetes. In local testing, the theme.config is being applied correctly. However, when we move to production, the theme is not being applied → it gets set to browser default settings (light or dark mode).
We did some debugging, and the app can find the .streamlit/config.toml file , but still, not being applied …
It’s really annoying for us and might be a deal breaker, but I hope not. Is there anyway to fix this?
We have tried different file configurations and locations, but nothing worked. Thanks for your thoughts on this!
Is it only theme that isn’t being applied or is all ofconfig.toml not applied? If you add secrets.toml with a simple value, can st.secretsread it? (If st.secrets can read from secrets.toml and config.toml is in the same directory as secrets.toml, there should be nothing stopping the system from reading the theme.) Also, can you use st.get_optionto see what Streamlit thinks is set for different theme and other config options to rule out something else interfering between the server and client?
Are you using the same working directory relative to your entrypoint file in both instances?
Thanks for your reply. I will try the approach with st.secrets.
On the other points, In my debugging steps, I added
print(st.get_option(f"theme.base"))
and what got printed was “light” → which showed me it was reading the config.toml themes. I also passed other values like “primaryColor”, “backgroundColor” - and they were picked up but not being applied.
Yes, I believe the working directory is relative to entry point in both instances, at least how we would set it up in Docker (as mentioned before, it works perfectly in local)
Here is my dockerfile ( I have had many different versions, but this is the latest working version)
FROM docker.jfrog.[secret].com/projects/[secret]/[secret]-python:3.12-stream9
USER root
WORKDIR /app
# App files
COPY ./assets/ /app/assets/
COPY ./tests/ /app/tests/
COPY ./pyproject.toml /app/pyproject.toml
COPY ./uv.lock /app/uv.lock
COPY ./streamlit_app.py /app/streamlit_app.py
COPY ./sql/ /app/sql/
COPY ./helpers.py /app/helpers.py
COPY ./config.py /app/config.py
COPY ./.env.local /app/.env.local
COPY ./.env.prod /app/.env.prod
# Put Streamlit theme where the app can see it
RUN mkdir -p /app/.streamlit
COPY .streamlit/config.toml /app/.streamlit/config.toml
# Keep base OS current
RUN dnf update -y && dnf clean all
# Create venv and install deps with uv
RUN pip install uv && \
python -m venv /app/.venv && \
. /app/.venv/bin/activate && \
uv sync --frozen --no-install-project \
--default-index https://jfrog.[secret].com/artifactory/api/pypi/pypi-virtual/simple
ENV VIRTUAL_ENV=/app/.venv
ENV PATH="/app/.venv/bin:${PATH}"
# Non-root runtime + perms
RUN useradd -m nonroot && chown -R nonroot:nonroot /app
USER nonroot
EXPOSE 8080
ENV ENV=prod
CMD ["python","-m","streamlit","run","streamlit_app.py","--server.port=8080","--server.address=0.0.0.0"]