如何在构builddocker实例时安装本地rpm文件?
我有以下的docker文件,我想特别安装我的磁盘上可用的rpm文件,因为我正在build立docker实例。 我的调用rpm安装看起来像这样。 命令RUN rpm -i chrpath-0.13-14.el7.x86_64.rpm
失败。
有没有办法将本地可用的rpm文件安装到新的Docker实例?
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
命令之前:
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
假设您在/opt/myproject/.
提供了Dockerfile /opt/myproject/.
那么首先你必须把rpm
放在/opt/myproject
,然后添加
Add /xyz.rpm /xyz.rpm RUN rpm -i xyz.rpm
我的Dockerfile constains这两行:
[...] ADD SRC/kernel-3.10.0-327.13.1.el7.x86_64.rpm /tmp/kernel-3.10.0-327.13.1.el7.x86_64.rpm ADD SRC/kernel-devel-3.10.0-327.13.1.el7.x86_64.rpm /tmp/kernel-devel-3.10.0-327.13.1.el7.x86_64.rpm [...]
build筑image processing失败,错误“lstat SRC / kernel-3.10.0-327.13.1.el7.x86_64.rpm:没有这样的文件或目录”
两个RPM文件都在我运行“docker build”的位置“SRC”文件夹内。
问题是什么??
谢谢。