无法打开RPM,在Dockerfile中跳过
我正在尝试创buildDockerfile来构build我们的可重新使用的映像。 我到目前为止是
FROM crystaltwix/centos-mono MAINTAINER crystaltwix ADD ./rpms/MyRpm.rpm ./rpms RUN yum --nogpgcheck localinstall ./rpms/MyRpm.rpm
我收到一个错误,说
Cannot open: ./rpms/Myrpm.rpm. Skipping.
我不明白为什么它不起作用,如果我在我的容器中运行图像:
sudo docker run -i -t -v /home/crystaltwix/projects/rpms:/opt/rpms crystaltwix/centos-mono /bin/bash
然后在我的容器的shell中,我执行相同的命令:
yum --nogpgcheck localinstall ./rpms/MyRpm.rpm
这工作正常。 它只是不能在我的Dockerfile中工作。 我是否缺lessDockerfile构build图像的具体方法? 提前致谢。
从https://docs.docker.com/reference/builder/#add : If <src> is any other kind of file, it is copied individually along with its metadata. In this case, if <dest> ends with a trailing slash /, it will be considered a directory and the contents of <src> will be written at <dest>/base(<src>).
If <src> is any other kind of file, it is copied individually along with its metadata. In this case, if <dest> ends with a trailing slash /, it will be considered a directory and the contents of <src> will be written at <dest>/base(<src>).
ADD ./rpms/MyRpm.rpm ./rpms
导致./rpms是MyRpm.rpm文件。 尝试使用ADD ./rpms/MyRpm.rpm ./rpms/
。