Docker 退出代码:下载 spaCy 时的 247 en_core_web_lg

Docker exit code: 247 when downloading spaCy's en_core_web_lg

当我尝试构建一个下载大文件的 Docker 图像时,我收到 exit code: 247。大文件是spaCyen_core_web_lg模型。

我试过下载 en_core_web_md 模型,效果很好。我还尝试不在 Docker 文件中下载 lg 模型,而是导航到容器并使用 python3 -m spacy download en_core_web_lg 下载它,但它随后似乎冻结了。

我怀疑这个问题与 777.1 MB 的模型有关,但我不确定如何在 Docker 文件或构建命令中解决这个问题。有什么想法吗?

Docker文件

FROM python:3.9

WORKDIR /app

RUN pip3 install spacy
RUN python3 -m spacy download en_core_web_lg

构建命令和错误

~> docker build -f Dockerfile -t app:latest .
[+] Building 22.8s (7/7) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                                                                                     0.0s
 => => transferring dockerfile: 37B                                                                                                                                                                                                                      0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                                                                                                                          0.0s
 => [internal] load metadata for docker.io/library/python:3.9                                                                                                                                                                                            0.3s
 => [1/4] FROM docker.io/library/python:3.9@sha256:e6654afa815122b13242fc9ff513e2d14b00548ba6eaf4d3b03f2f261d85272d                                                                                                                                      0.0s
 => CACHED [2/4] WORKDIR /app                                                                                                                                                                                                                            0.0s
 => CACHED [3/4] RUN pip3 install spacy                                                                                                                                                                                                                  0.0s
 => ERROR [4/4] RUN python3 -m spacy download en_core_web_lg                                                                                                                                                                                            22.4s
------
~> [4/4] RUN python3 -m spacy download en_core_web_lg:
#6 1.921 Collecting en-core-web-lg==3.1.0
#6 2.125   Downloading https://github.com/explosion/spacy-models/releases/download/en_core_web_lg-3.1.0/en_core_web_lg-3.1.0-py3-none-any.whl (777.1 MB)
------
executor failed running [/bin/sh -c python3 -m spacy download en_core_web_lg]: exit code: 247

为容器分配更多内存并申请