Using Streamlit Inside Docker Container

While Trying to use Streamlit within a docker environment,
Docker Image is as follows,

# build the image required for setting up the repository
# Example run:
# $ docker build -t wadhwaniai/tb-cough:v0 .
# Creates a docker image with desired dependencies

FROM pytorchlightning/pytorch_lightning:base-cuda-py3.8-torch1.8

# setup group ID
ARG USER=user
ARG GID=3005

ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get install -y \
    aufs-tools \
    automake \
    build-essential \
    curl \
    dpkg-sig \
    libcap-dev \
    libsqlite3-dev \
    mercurial \
    virtualenv \
    reprepro \
	tmux \
    ffmpeg \
    ruby1.9.1 && rm -rf /var/lib/apt/lists/*

# change working directory to /
WORKDIR /

# set the PYTHONPATH required for using the repository
ENV PYTHONPATH /workspace/tb-cough
RUN mkdir .jupyter .local .pylint.d .cache .cmake .config .conda .gnupg .ipython .ipynb_checkpoints .nano .nv .vim && \
    ls | grep -v sys | grep -v proc | grep -v usr | while read line; do chown -R $GID:$GID $line; chmod -R ugo+rwx $line; done && \
    ls -ld .?* | awk '{print $9}' | grep -v "\.\." |  while read line; do chown -R $GID:$GID $line; chmod -R ugo+rwx $line; done;

# set the PYTHONPATH required for using the repository
ENV PYTHONPATH /workspace/tb-cough

# set actual working directory
WORKDIR /workspace/tb-cough

# copy the requirements file to the working directory
COPY requirements.txt .

# Install the required packages
RUN apt-get update && apt-get install -y libsndfile1-dev
RUN cat requirements.txt | xargs -n 1 pip install | while read line; do echo $line; done;

And the requirements.txt contains the streamlit package.

  1. Do you think this is the right way to use streamlit within a docker environment? This docker image would not be used only for this streamlit application so I do not want to run CMD in the dockerfile itself to start the app.
  2. I am currently getting this error while trying to do streamlit run
Traceback (most recent call last):
  File "/usr/local/bin/streamlit", line 5, in <module>
    from streamlit.cli import main
ModuleNotFoundError: No module named 'streamlit.cli'

Any leads on how to resolve this?