gpt4 book ai didi

docker - 无法在我的容器中安装解压缩工具

转载 作者:行者123 更新时间:2023-12-02 21:32:52 25 4
gpt4 key购买 nike

我尝试安装unzip在我的centos容器。
我的 Dockerfile 看起来像这样:

FROM centos
...

RUN apt-get update -y && apt-get upgrade -y
RUN apt-get install -y unzip
当我构建图像时,我收到错误:
Step 9/12 : RUN apt-get update -y && apt-get upgrade -y
---> Running in 65457527bac0
/bin/sh: apt-get: command not found
如何在我的容器中安装解压缩工具?

最佳答案

由于您使用的是 CentO,默认的包管理器不是 apt-get 而是 yum。
因此,您的 dockerfile 应该是这样的:

FROM centos
...

RUN yum update
RUN yum install unzip
作为更详细的解释,您可以记住这一点: apt-get是基于 debian 的 Linux 发行版(如 Ubuntu 和其他许多其他发行版)的默认包管理器。 yum是基于 RPM 的发行版的默认包管理器(Redhat 包管理器)

关于docker - 无法在我的容器中安装解压缩工具,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64046257/

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