Not able to install unzip tool in my container

Viewed 3722

I try to install unzip in my centos container.

My Dockerfile looks like this:

FROM centos
...

RUN apt-get update -y && apt-get upgrade -y
RUN apt-get install -y unzip

When I build the image, I get the error:

Step 9/12 : RUN apt-get update -y && apt-get upgrade -y
 ---> Running in 65457527bac0
/bin/sh: apt-get: command not found

How can I install unzip tool in my container?

1 Answers

Since you're using CentOs the default package manager is not apt-get but instead yum.

So doing this is what your dockerfile should look like:

FROM centos
...

RUN yum update
RUN yum install unzip

As a more detailed explanation you can remember this:

apt-get is the default package manager for debian based distributions of Linux like Ubuntu and a bunch of others. yum is the default package manager for RPM based distributions ( Redhat package manager )

Related