[GCP][App Engine] Streamlit Web 应用程序部署 - 容器崩溃了

问题描述 投票:0回答:1

我正在尝试在 Google App Engine 上部署使用 Streamlit 开发的 Web 应用程序。当部署过程接近完成时。我收到以下错误:

ERROR: (gcloud.app.deploy) Error Response: [9]
Application startup error! Code: APP_CONTAINER_CRASHED

  You can now view your Streamlit app in your browser.

  Network URL: http://172.17.0.6:8080
  External URL: http://34.67.15.189:8080

Killed

我无法理解此错误的根本原因。任何建议和/或帮助将不胜感激。

编辑:

我正在使用灵活的环境。 app.yaml如下:

runtime: custom
env: flex

runtime_config:
  python_version: 3

manual_scaling:
  instances: 1
resources:
  cpu: 1
  memory_gb: 5
  disk_size_gb: 25

Dockerfile如下:

FROM python:3.7

# Copy local code to the container image.
WORKDIR /app
COPY requirements.txt ./requirements.txt

# Install dependencies.
RUN pip3 install -r requirements.txt

EXPOSE 8080

COPY . /app

# Run the web service on container startup.
CMD streamlit run --server.port 8080 --server.enableCORS false app.py

并且,要求是:

pandas==0.24.2
scikit_learn==0.23.1
streamlit==0.62.1
python google-cloud-platform google-app-engine streamlit
1个回答
2
投票

我使用了 streamlit 示例应用程序和您的配置文件,我注意到您正在定义

runtime_config
,这不是必需的,因为您在 Dockerfile 中选择了通用 python docker 映像,这仅适用于 App Engine 的 Python 映像。

有关自定义运行时的更多信息,请查看此文档

对文件进行一些修改后,所有内容都通过使用示例应用程序运行,请随意使用这些文件作为起始点。

这是我的文件夹结构

./
├── app.py
├── app.yaml
├── Dockerfile
└── requirements.txt

这是我的app.yaml

runtime: custom
env: flex

manual_scaling:
  instances: 1

resources:
  cpu: 4
  memory_gb: 5
  disk_size_gb: 25

这是我的 Dockerfile

FROM python:3.7

# Copy local code to the container image.
WORKDIR /app
COPY requirements.txt ./requirements.txt

# Install dependencies.
RUN pip3 install -r requirements.txt

EXPOSE 8080

COPY . /app

# Run the web service on container startup.
CMD streamlit run --server.port 8080 --server.enableCORS false /app/app.py

© www.soinside.com 2019 - 2024. All rights reserved.