我尝试在我的 centos
容器中安装 unzip
。
我的 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
如何在我的容器中安装解压工具?
最佳答案
由于您使用的是 CentOs,默认包管理器不是 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/