.streamlit/config.toml is not run when docker image is created

Hi all, this is my first post so please excuse me if I do not follow any particular rules/guidelines. I’ve been playing around with streamlit extensively and have currently coded a docker file that creates a docker container and image of my streamlit code.

I wish to increase the file_upload size, which I am aware can be done in the .streamlit/config.toml file. I have tested this on my local host and the changes are reflecting fine, however, as soon as I create my docker images the changes don’t follow across there. I have looked at several other blog posts, specifically Post A and Post B, and have tried both but was unsuccessful. Additionally, I have tried moving the .streamlit folder to the location of the main streamlit page as well as the root folder and that has not worked. Furthermore, I have tried including the following command in my file but that also did not yield anything: --server.maxUploadSize=4000.

This is how my dockerfile is currently set up:

FROM python:3.7.9

WORKDIR /

COPY /requirements.txt ./

RUN python -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org --upgrade pip==21.1.1

RUN python -m pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org -r requirements.txt

COPY . /working_directory/

RUN ls

EXPOSE 8501

ENTRYPOINT ["streamlit", "run", "./working_directory/src/code/app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.maxUploadSize=4000"]

The following is a very high level view of my folder structure. *NOTE: The folder structure below falls under the working_directory folder that is specified in the dockerfile above.

├── CertEmulationCA.crt  
|   
├── Dockerfile          
|   
├── LICENSE
|
├── README.md            
|   
├── requirements.txt      
│
├── src       
|   |                     
│   ├── code
│   │    ├── app.py  <-- the main streamlit file that is run
│   │    ├── pages  
│   ├── data
│
├── .streamlit
|   |                     
│   ├── config.toml

Any help would be much appreciated! :slight_smile:

https://docs.streamlit.io/library/advanced-features/configuration

I think this is the problem, you are starting streamlit from the root folder, but the .streamlit/config.toml is located under /working_directory/ subfolder after the COPY action?

2 Likes

You were 100% correct. Thanks for the observation.

I just added the following code after the COPY . /AiDE/ line in the dockerfile and everything seems to be working as expected: COPY .streamlit/ ./.streamlit/

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