【问题标题】:How to install apt-get when building docker image from pytorch/manylinux-cpu base image?从 pytorch/manylinux-cpu 基础镜像构建 docker 镜像时如何安装 apt-get?
【发布时间】:2022-01-14 20:05:21
【问题描述】:

我正在尝试从基于 cpu 的 pytorch 基础映像构建 docker 映像。它适用于 gpu 基础映像,但需要节省一些空间并在 cpu 上运行。所以我使用以下 Dockerfile 来构建我的图像,但似乎我需要安装 apt-get。所以现在的问题是,我怎样才能在这个容器中获得 apt-get,或者有替代方法吗?就像基于高山的容器一样,我看到有 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 docker ubuntu pytorch apt-get


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-09-29
      • 2017-04-24
      • 1970-01-01
      • 2020-01-20
      • 1970-01-01
      • 2020-07-24
      • 1970-01-01
      • 2017-12-31
      相关资源
      最近更新 更多