gpt4 book ai didi

linux - 从 pytorch/manylinux-cpu 基础镜像构建 docker 镜像时如何安装 apt-get?

转载 作者:行者123 更新时间:2023-12-04 19:26:36 28 4
gpt4 key购买 nike

我正在尝试从基于 cpu 的 pytorch 基础镜像构建 docker 镜像。它适用于 gpu 基础镜像,但需要节省一些空间并在 cpu 上运行。所以我使用以下 Dockerfile 来构建我的图像,但似乎我需要安装 apt-get。所以现在,问题是,我怎样才能在这个容器中获得 apt-get,或者有替代方法吗?就像基于 Alpine 的容器一样,我看到有 apk 而不是 apt-get。但问题是,我什至不知道如何为我的基础镜像找出容器库。我以为是linux。

#FROM pytorch/pytorch:latest
FROM pytorch/manylinux-cpu:latest

RUN set -xe \
&& apt-get update \
&& apt-get install -y python-pip
RUN pip install --upgrade pip

RUN pip install waitress flask scikit-learn torch_optimizer pandas geffnet

WORKDIR /app
COPY . .
我收到的错误是:
$ docker build . -t cpu_web_app
Sending build context to Docker daemon 2.31GB
Step 1/8 : FROM pytorch/manylinux-cpu:latest
---> f28a327c8487
Step 2/8 : RUN set -xe && apt-get update && apt-get install -y python-pip
---> Running in 31cead57ae3d
+ apt-get update
/bin/sh: apt-get: command not found
The command '/bin/sh -c set -xe && apt-get update && apt-get install -y python-pip' returned a non-zero code: 127
感谢您的帮助和任何提示!

最佳答案

现在想通了,您需要查看基本镜像并找出您使用的 linux 发行版。在这种情况下,CENTos,然后只需遵循此发行版的标准程序

关于linux - 从 pytorch/manylinux-cpu 基础镜像构建 docker 镜像时如何安装 apt-get?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70299277/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com