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

Not able to install unzip tool in my container

我尝试在我的 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 包管理器)