Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install a local rpm file when building docker instance?

I have following docker file, I want to specifically install a rpm file that is available on my disk as I am building docker instance. My invocation of rpm install looks like this. Command RUN rpm -i chrpath-0.13-14.el7.x86_64.rpm fails.

Is there a way to install rpm file available locally to new Docker instance?

FROM centos:latest
    RUN yum -y install yum-utils
    RUN yum -y install python-setuptools
    RUN easy_install supervisor
    RUN mkdir -p /var/log/supervisor
    RUN yum -y install which
    RUN yum -y install git
    # Basic build dependencies.
    RUN yum -y install  autoconf build-essential unzip zip
    # Gold linker is much faster than standard linker.
    RUN yum -y install  binutils
    # Developer tools.
    RUN yum -y install bash-completion curl emacs git man-db python-dev python-pip vim tar
    RUN yum -y install gcc gcc-c++ kernel-devel make
    RUN yum -y install swig
    RUN yum -y install wget
    RUN yum -y install python-devel
    RUN yum -y install ntp
    RUN rpm -i chrpath-0.13-14.el7.x86_64.rpm
like image 333
Subodh Nijsure Avatar asked May 06 '15 16:05

Subodh Nijsure


People also ask

What is the command to install RPM package in Linux?

We can install the RPM package with the following command: rpm -ivh <package name> . Note the -v option will show verbose output and the -h will show the hash marks, which represents action of the progress of the RPM upgrade. Lastly, we run another RPM query to verify the package will be available.

Can we deploy WAR file in Docker?

In this article, we've learned to deploy a Java WAR file in a Docker container. We started by creating the Dockerfile using the official Tomcat Docker image. Then, we built the Docker image and ran the application container.


2 Answers

Put this line before your rpm -i command:

ADD /host/abs/path/to/chrpath-0.13-14.el7.x86_64.rpm /chrpath-0.13-14.el7.x86_64.rpm

Then you'll be able to do

RUN rpm -i chrpath-0.13-14.el7.x86_64.rpm
like image 177
Vitaly Isaev Avatar answered Sep 17 '22 19:09

Vitaly Isaev


As and addendum to what others have written here, rather than using:

RUN rpm -i xyz.rpm

You might be better off doing this:

RUN yum install -y xyz.rpm

The latter has the advantages that (a) it checks the signature, (b) downloads any dependencies, and (c) makes sure YUM knows about the package. This last bit is less important than the other two, but it's still worthwhile.

like image 33
Keith Gaughan Avatar answered Sep 17 '22 19:09

Keith Gaughan