【问题标题】:Streamlit showing me "Welcome to Streamlit" message when executing it with DockerStreamlit 在使用 Docker 执行时向我显示“欢迎使用 Streamlit”消息
【发布时间】:2022-06-21 15:19:49
【问题描述】:

我正在尝试运行从这个 Dockerfile 创建的 Docker 容器

FROM selenium/standalone-chrome
WORKDIR /app

# Install dependencies
USER root
RUN apt-get update && apt-get install python3-distutils -y
RUN wget https://bootstrap.pypa.io/get-pip.py
RUN python3 get-pip.py

COPY requirements.txt ./requirements.txt
RUN pip install -r requirements.txt
RUN pip install selenium==4.1

# Copy src contents
COPY /src /app/

# Expose the port
EXPOSE 8501

# Execution
ENTRYPOINT [ "streamlit", "run" ]
CMD ["app.py"]

构建这个容器是可能的,但是当我执行镜像时,我得到以下消息:

???? Welcome to Streamlit!

  If you're one of our development partners or you're interested in getting
  personal technical support or Streamlit updates, please enter your email
  address below. Otherwise, you may leave the field blank.

  Email: 2022-06-06 09:20:27.690 

因此,当执行停止时,我无法按 Enter 键并继续执行。你们知道我应该如何让我的 Dockerfile 直接执行streamlit run 命令并超越这个问题吗?

【问题讨论】:

    标签: python docker streamlit


    【解决方案1】:

    当不存在具有以下内容的~/.streamlit/credentials.toml 文件时,将显示该欢迎消息:

    [general]
    email=""
    

    您可以在您的应用目录中创建上述文件 (.streamlit/credentials.toml) 并将其内容复制到您的 Dockerfile 中的容器映像中,或者在以下位置使用 RUN 命令创建此文件:

    mkdir -p ~/.streamlit/
    echo "[general]"  > ~/.streamlit/credentials.toml
    echo "email = \"\""  >> ~/.streamlit/credentials.toml
    

    我建议使用前一种方法来减少层数,从而减小最终图像的大小。

    【讨论】:

      猜你喜欢
      • 2017-03-06
      • 2021-12-26
      • 1970-01-01
      • 2020-07-02
      • 2022-01-13
      • 1970-01-01
      • 2021-11-09
      • 2022-12-14
      • 1970-01-01
      相关资源
      最近更新 更多