"/bin/sh: 1: [streamlit,: not found" in Docker container

I am using the following Dockerfile, which is quite identical to the recommended Dockerfile of the docs (Deploy Streamlit using Docker - Streamlit Docs)

Instead of cloning a github repo as shown in the docs, I copy my streamlit project into the WORKDIR /app. The project contains the folder “ui_ppi_predictor”, which provides the main file of the project called 0_🏠_Home.py and all other *.py files of the project.

If I inspect the docker container file structure, it looks like:
– .streamlit
– requirements.txt
– /ui_ppi_predictor
----> 0_🏠_Home.py
----> /utils/…
----> /components/…
----> /pages
--------> 0_ComparisionView.py
--------> …
----> …

However, I always get the error when starting/running the image: /bin/sh: 1: [streamlit,: not found

If I start/run the image with “docker run -p 8501:8501 -it test-image sh” with shell, streamlit works fine within the shell of the container (e.g by executing “streamlit --version” or running the project as provided in the ENTRYPOINT).

FROM python:3.11-slim


RUN apt-get update && apt-get install -y
&& rm -rf /var/lib/apt/lists/*

COPY . .

RUN pip3 install -r requirements.txt


HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health

ENTRYPOINT [“streamlit”, “run”, “ui_ppi_predictor\0_🏠_Home.py”, “–server.port=8501”, “–server.address=”]

Requirements.txt looks as follows:

streamlit == 1.28.0
pandas == 2.0.3
numpy == 1.25.1
pytorch-lightning == 2.0.6
transformers == 4.31.0
torch-optimizer == 0.3.0
stmol == 0.0.9
py3dmol == 2.0.3
biotite == 0.37.0
ipython-genutils == 0.2.0
torch == 2.0.0
wandb == 0.16.0
scikit-learn == 1.3.2
pytorch-nlp == 0.5.0
test-tube == 0.7.5
streamlit-authenticator == 0.2.3
xgboost == 1.7.3

  • Use CMD instead of ENTRYPOINT
  • Don’t use windows paths with \

Hi, thanks for your response.
Unfortunately, CMD does not help.
How should the path "" look like?

I restructured my whole project, so that I can execute “streamlit run main.py” from the /app directory in the container. With this change, I can start/run the container as expected.