Dockerfile构建RUN cmd失败但可以从交互式

时间:2016-12-06 20:08:24

标签: docker dockerfile

我遇到了一个问题,即在'make'命令中构建Dockerfile失败但如果我运行-it容器并再次生成它就成功了。具体来说,make命令似乎没有看到文件:

make[2]: *** No rule to make target /usr/local/nvidia/lib64/libcuda.so, needed by bin/gpu-example-alpha_comp. Stop.

但这是基于nvidia / cuda:8.0-cudnn5-devel和libcuda.so就在那里,即如果我运行-it容器:

root@cf5637b85467:/opt/opencv/opencv/build# ll /usr/local/nvidia/lib64/libcuda*.*
lrwxrwxrwx 1 999 999 17 Nov 21 20:42 /usr/local/nvidia/lib64/libcuda.so -> libcuda.so.370.28
lrwxrwxrwx 1 999 999 17 Nov 21 20:42 /usr/local/nvidia/lib64/libcuda.so.1 -> libcuda.so.370.28
-rw-r--r-- 2 root root 8219624 Sep 2 02:25 /usr/local/nvidia/lib64/libcuda.so.370.28

如果我手动运行它就完成而没有问题(我尝试从/ bin / bash和/ bin / sh运行)。

我唯一能看到的是用户& .so链接的999组,但我不知道这是否相关。在最糟糕的情况下,我可以在建造后承诺,但这似乎是一个不好的方法。有什么建议?完整的Dockerfile如下:

FROM nvidia/cuda:8.0-cudnn5-devel

RUN apt-get update &&\
    apt-get install -y --no-install-recommends \
    build-essential \
    cmake \
    curl \ 
    gfortran \
    git \
    libatlas-base-dev \
    libavcodec-dev \
    libavformat-dev \
    libfreetype6-dev \
    libgtk2.0-dev \
    libjasper-dev \
    libjpeg8-dev \
    libpng12-dev \
    libswscale-dev \
    libtiff4-dev \
    libv4l-dev \
    pkg-config \
    python2.7-dev \
    && \
    apt-get clean && \
    apt-get autoremove && \
    rm -rf /var/lib/apt/lists/*

# Get pip and pip installs
RUN curl -O https://bootstrap.pypa.io/get-pip.py && \
    python get-pip.py && \
    rm get-pip.py

RUN pip --no-cache-dir --timeout=60 install \
    numpy

# Install opencv and opencv_contrib
WORKDIR /opt/opencv
RUN git clone --depth 1 https://github.com/opencv/opencv.git && \
    git clone --depth 1 https://github.com/opencv/opencv_contrib.git

WORKDIR /opt/opencv/opencv/build
RUN cmake -D CMAKE_BUILD_TYPE=RELEASE \
            -D CMAKE_INSTALL_PREFIX=/usr/local \
            -D INSTALL_C_EXAMPLES=ON \
            -D INSTALL_PYTHON_EXAMPLES=ON \
            -D OPENCV_EXTRA_MODULES_PATH=/opt/opencv/opencv_contrib/modules \
            -D CUDA_CUDA_LIBRARY=/usr/local/nvidia/lib64/libcuda.so \
            -D BUILD_EXAMPLES=ON ..
RUN make -j8 
RUN make install 

0 个答案:

没有答案