当我docker build
下面的Dockerfile时,它出错(退出状态1)。但是当我手动在centos:centos7
中运行相同的脚本时,它就会通过。
FROM centos:centos7
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES compute,utility
ENV NVIDIA_REQUIRE_CUDA "cuda>=8.0"
RUN yum -y -q install \
wget \
epel-release && \
wget -q https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda-repo-rhel7-8-0-local-ga2-8.0.61-1.x86_64-rpm && \
mv cuda-repo-rhel7-8-0-local-ga2-8.0.61-1.x86_64-rpm cuda-repo.rpm && \
rpm -i cuda-repo.rpm && \
yum install -y \
# cuda && \
xorg-x11-drv-nvidia.x86_64
两个选项均失败,但是xorg-x11-drv-nvidia.x86_64似乎是罪魁祸首。
错误消息:
...
Installing : 1:nvidia-kmod-375.26-2.el7.x86_64
53/60
Creating symlink /var/lib/dkms/nvidia/375.26/source ->
/usr/src/nvidia-375.26
DKMS: add completed.
Error! echo
Your kernel headers for kernel 4.4.0-127-generic cannot be found at
/lib/modules/4.4.0-127-generic/build or /lib/modules/4.4.0-127-generic/source.
Error! echo
Your kernel headers for kernel 4.4.0-127-generic cannot be found at
/lib/modules/4.4.0-127-generic/build or /lib/modules/4.4.0-127-generic/source.
warning: %post(nvidia-kmod-1:375.26-2.el7.x86_64) scriptlet failed, exit status 1
Non-fatal POSTIN scriptlet failure in rpm package 1:nvidia-kmod-375.26-2.el7.x86_64
Installing : 1:xorg-x11-drv-nvidia-375.26-1.el7.x86_64 54/60Error unpacking rpm package 1:xorg-x11-drv-nvidia-375.26-1.el7.x86_64
error: unpacking of archive failed on file /usr/bin/nvidia-cuda-mps-control: cpio: rename
Updating : elfutils-libs-0.170-4.el7.x86_64
55/60
error: xorg-x11-drv-nvidia-1:375.26-1.el7.x86_64: install failed
Cleanup : elfutils-libs-0.168-8.el7.x86_64
56/60
Cleanup : elfutils-libelf-0.168-8.el7.x86_64
57/60
Cleanup : glibc-common-2.17-196.el7_4.2.x86_64
58/60
Cleanup : glibc-2.17-196.el7_4.2.x86_64
59/60
Cleanup : libgcc-4.8.5-16.el7_4.2.x86_64
60/60
Verifying : libXext-1.3.3-3.el7.x86_64
1/60
...
什么会导致yum在docker构建期间失败但在交互式shell中运行时成功?