构建 docker 实例时如何安装本地 rpm 文件? [英] How to install a local rpm file when building docker instance?

查看:22
本文介绍了构建 docker 实例时如何安装本地 rpm 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下 docker 文件,我想在构建 docker 实例时专门安装磁盘上可用的 rpm 文件.我对 rpm install 的调用如下所示.命令RUN rpm -i chrpath-0.13-14.el7.x86_64.rpm 失败.

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.

有没有办法为新的 Docker 实例安装本地可用的 rpm 文件?

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

推荐答案

将此行放在 rpm -i 命令之前:

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

那你就可以了

RUN rpm -i chrpath-0.13-14.el7.x86_64.rpm

这篇关于构建 docker 实例时如何安装本地 rpm 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆