“make all -j”$(nproc)" command works within Docker container but not in Dockerfile





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















I wrote the following Dockerfile to build an image with OpenPose (https://github.com/CMU-Perceptual-Computing-Lab/openpose)



# Download base image
FROM nvidia/cuda:9.0-cudnn7-devel

# Set keyboard configuration in advance of installing CUDA
#RUN apt-get update && apt-get install -yq keyboard-configuration

#==========Caffe dependencies=================
RUN apt-get --assume-yes update &&
apt-get --assume-yes install build-essential
libatlas-base-dev
libprotobuf-dev
libleveldb-dev
libsnappy-dev
libhdf5-serial-dev
protobuf-compiler

RUN apt-get --assume-yes install --no-install-recommends libboost-all-dev

# Remaining dependencies
RUN apt-get --assume-yes install libgflags-dev
libgoogle-glog-dev
liblmdb-dev

#=========OpenCV============
RUN apt-get update && apt-get --assume-yes install libopencv-dev
python-opencv
python-pip
python-dev
cmake
libeigen3-dev
doxygen

#=========Python Libs=======
RUN pip install --upgrade numpy
protobuf
opencv-python

#=========OpenPose==========
RUN apt-get -y install git
RUN git clone --depth 10 https://github.com/CMU-Perceptual-Computing-Lab/openpose.git /opt/openpose
RUN apt-get install -y cmake

# Set environment variables
ENV PATH "/usr/local/cuda-9.0/bin:$PATH"
ENV LD_LIBRARY_PATH "/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH"
ENV OPENPOSE_ROOT /opt/openpose

RUN cd /opt/openpose &&
mkdir -p build && cd build &&
cmake
-DCMAKE_BUILD_TYPE="Release"
-DBUILD_EXAMPLES=ON
-DBUILD_DOCS=ON
-DBUILD_SHARED_LIBS=ON
-DDOWNLOAD_BODY_25_MODEL=ON
-DDOWNLOAD_BODY_COCO_MODEL=ON
-DDOWNLOAD_BODY_MPI_MODEL=ON
-DDOWNLOAD_HAND_MODEL=ON
-DWITH_3D_RENDERER:BOOL=OFF
-DBUILD_PYTHON=ON ../

RUN printenv && cd opt/openpose/build && make all -n -j"$(nproc)"


When building the Dockerfile with nvidia-docker build -t openpose_image . I get the following error in the last step:



Step 14/14 : RUN printenv && cd opt/openpose/build && make all -n -j"$(nproc)"
---> Running in 8cbc7a731e6d
LIBRARY_PATH=/usr/local/cuda/lib64/stubs
HOSTNAME=8cbc7a731e6d
LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
HOME=/root
CUDA_VERSION=9.0.176
NVIDIA_REQUIRE_CUDA=cuda>=9.0
NVIDIA_DRIVER_CAPABILITIES=compute,utility
PATH=/usr/local/cuda-9.0/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
CUDA_PKG_VERSION=9-0=9.0.176-1
CUDNN_VERSION=7.4.1.5
PWD=/
NVIDIA_VISIBLE_DEVICES=all
NCCL_VERSION=2.3.7
OPENPOSE_ROOT=/opt/openpose
/usr/bin/cmake -H/opt/openpose -B/opt/openpose/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /opt/openpose/build/CMakeFiles /opt/openpose/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make -f CMakeFiles/doc_doxygen.dir/build.make CMakeFiles/doc_doxygen.dir/depend
make -f CMakeFiles/openpose_caffe.dir/build.make CMakeFiles/openpose_caffe.dir/depend
cd /opt/openpose/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /opt/openpose /opt/openpose /opt/openpose/build /opt/openpose/build /opt/openpose/build/CMakeFiles/doc_doxygen.dir/DependInfo.cmake --color=
make -f CMakeFiles/doc_doxygen.dir/build.make CMakeFiles/doc_doxygen.dir/build
cd /opt/openpose/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /opt/openpose /opt/openpose /opt/openpose/build /opt/openpose/build /opt/openpose/build/CMakeFiles/openpose_caffe.dir/DependInfo.cmake --color=
make -f CMakeFiles/openpose_caffe.dir/build.make CMakeFiles/openpose_caffe.dir/build
/usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=1 "Generating API documentation with Doxygen"
cd /opt/openpose/doc && /usr/bin/doxygen /opt/openpose/doc/doc_autogeneration.doxygen
/usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=4 "Creating directories for 'openpose_caffe'"
/usr/bin/cmake -E make_directory /opt/openpose/3rdparty/caffe
/usr/bin/cmake -E make_directory /opt/openpose/build/caffe/src/openpose_caffe-build
/usr/bin/cmake -E make_directory /opt/openpose/build/caffe
/usr/bin/cmake -E make_directory /opt/openpose/build/caffe/tmp
/usr/bin/cmake -E make_directory /opt/openpose/build/caffe/src/openpose_caffe-stamp
/usr/bin/cmake -E make_directory /opt/openpose/build/caffe/src
/usr/bin/cmake -E touch /opt/openpose/build/caffe/src/openpose_caffe-stamp/openpose_caffe-mkdir
/usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=5 "No download step for 'openpose_caffe'"
/usr/bin/cmake -E echo_append
/usr/bin/cmake -E touch /opt/openpose/build/caffe/src/openpose_caffe-stamp/openpose_caffe-download
/usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=7 "No patch step for 'openpose_caffe'"
/usr/bin/cmake -E echo_append
/usr/bin/cmake -E touch /opt/openpose/build/caffe/src/openpose_caffe-stamp/openpose_caffe-patch
/usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=6 "No update step for 'openpose_caffe'"
/usr/bin/cmake -E echo_append
/usr/bin/cmake -E touch /opt/openpose/build/caffe/src/openpose_caffe-stamp/openpose_caffe-update
/usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=8 "Performing configure step for 'openpose_caffe'"
cd /opt/openpose/build/caffe/src/openpose_caffe-build && /usr/bin/cmake -DCMAKE_INSTALL_PREFIX:PATH=/opt/openpose/build/caffe -DUSE_CUDNN=ON -DCUDA_ARCH_NAME=Auto -DCPU_ONLY=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_docs=OFF -DBUILD_python=OFF -DBUILD_python_layer=OFF -DUSE_LEVELDB=OFF -DUSE_LMDB=OFF -DUSE_OPENCV=OFF "-GUnix Makefiles" /opt/openpose/3rdparty/caffe
cd /opt/openpose/build/caffe/src/openpose_caffe-build && /usr/bin/cmake -E touch /opt/openpose/build/caffe/src/openpose_caffe-stamp/openpose_caffe-configure
/usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=9 "Performing build step for 'openpose_caffe'"
cd /opt/openpose/build/caffe/src/openpose_caffe-build && make
/usr/bin/cmake -E cmake_echo_color --switch= --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=1 "Built target doc_doxygen"
make[3]: *** No targets specified and no makefile found. Stop.
CMakeFiles/openpose_caffe.dir/build.make:110: recipe for target 'caffe/src/openpose_caffe-stamp/openpose_caffe-build' failed
make[2]: *** [caffe/src/openpose_caffe-stamp/openpose_caffe-build] Error 2
CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/openpose_caffe.dir/all' failed
make[1]: *** [CMakeFiles/openpose_caffe.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
The command '/bin/sh -c printenv && cd opt/openpose/build && make all -n -j"$(nproc)"' returned a non-zero code: 2


Two weird things also happen here. 1) If I run the image built so far with docker run -it openpose_image and then cd opt/openpose/build && make all -j"$(nproc)" I get the same exact error. 2) If I do instead nvidia-docker run -it openpose_image and then cd opt/openpose/build && make all -j"$(nproc)" the building runs smoothly, ending successfully without raising errors. Can somebody help me to figure out what is going on? Thanks










share|improve this question































    1















    I wrote the following Dockerfile to build an image with OpenPose (https://github.com/CMU-Perceptual-Computing-Lab/openpose)



    # Download base image
    FROM nvidia/cuda:9.0-cudnn7-devel

    # Set keyboard configuration in advance of installing CUDA
    #RUN apt-get update && apt-get install -yq keyboard-configuration

    #==========Caffe dependencies=================
    RUN apt-get --assume-yes update &&
    apt-get --assume-yes install build-essential
    libatlas-base-dev
    libprotobuf-dev
    libleveldb-dev
    libsnappy-dev
    libhdf5-serial-dev
    protobuf-compiler

    RUN apt-get --assume-yes install --no-install-recommends libboost-all-dev

    # Remaining dependencies
    RUN apt-get --assume-yes install libgflags-dev
    libgoogle-glog-dev
    liblmdb-dev

    #=========OpenCV============
    RUN apt-get update && apt-get --assume-yes install libopencv-dev
    python-opencv
    python-pip
    python-dev
    cmake
    libeigen3-dev
    doxygen

    #=========Python Libs=======
    RUN pip install --upgrade numpy
    protobuf
    opencv-python

    #=========OpenPose==========
    RUN apt-get -y install git
    RUN git clone --depth 10 https://github.com/CMU-Perceptual-Computing-Lab/openpose.git /opt/openpose
    RUN apt-get install -y cmake

    # Set environment variables
    ENV PATH "/usr/local/cuda-9.0/bin:$PATH"
    ENV LD_LIBRARY_PATH "/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH"
    ENV OPENPOSE_ROOT /opt/openpose

    RUN cd /opt/openpose &&
    mkdir -p build && cd build &&
    cmake
    -DCMAKE_BUILD_TYPE="Release"
    -DBUILD_EXAMPLES=ON
    -DBUILD_DOCS=ON
    -DBUILD_SHARED_LIBS=ON
    -DDOWNLOAD_BODY_25_MODEL=ON
    -DDOWNLOAD_BODY_COCO_MODEL=ON
    -DDOWNLOAD_BODY_MPI_MODEL=ON
    -DDOWNLOAD_HAND_MODEL=ON
    -DWITH_3D_RENDERER:BOOL=OFF
    -DBUILD_PYTHON=ON ../

    RUN printenv && cd opt/openpose/build && make all -n -j"$(nproc)"


    When building the Dockerfile with nvidia-docker build -t openpose_image . I get the following error in the last step:



    Step 14/14 : RUN printenv && cd opt/openpose/build && make all -n -j"$(nproc)"
    ---> Running in 8cbc7a731e6d
    LIBRARY_PATH=/usr/local/cuda/lib64/stubs
    HOSTNAME=8cbc7a731e6d
    LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
    HOME=/root
    CUDA_VERSION=9.0.176
    NVIDIA_REQUIRE_CUDA=cuda>=9.0
    NVIDIA_DRIVER_CAPABILITIES=compute,utility
    PATH=/usr/local/cuda-9.0/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
    CUDA_PKG_VERSION=9-0=9.0.176-1
    CUDNN_VERSION=7.4.1.5
    PWD=/
    NVIDIA_VISIBLE_DEVICES=all
    NCCL_VERSION=2.3.7
    OPENPOSE_ROOT=/opt/openpose
    /usr/bin/cmake -H/opt/openpose -B/opt/openpose/build --check-build-system CMakeFiles/Makefile.cmake 0
    /usr/bin/cmake -E cmake_progress_start /opt/openpose/build/CMakeFiles /opt/openpose/build/CMakeFiles/progress.marks
    make -f CMakeFiles/Makefile2 all
    make -f CMakeFiles/doc_doxygen.dir/build.make CMakeFiles/doc_doxygen.dir/depend
    make -f CMakeFiles/openpose_caffe.dir/build.make CMakeFiles/openpose_caffe.dir/depend
    cd /opt/openpose/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /opt/openpose /opt/openpose /opt/openpose/build /opt/openpose/build /opt/openpose/build/CMakeFiles/doc_doxygen.dir/DependInfo.cmake --color=
    make -f CMakeFiles/doc_doxygen.dir/build.make CMakeFiles/doc_doxygen.dir/build
    cd /opt/openpose/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /opt/openpose /opt/openpose /opt/openpose/build /opt/openpose/build /opt/openpose/build/CMakeFiles/openpose_caffe.dir/DependInfo.cmake --color=
    make -f CMakeFiles/openpose_caffe.dir/build.make CMakeFiles/openpose_caffe.dir/build
    /usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=1 "Generating API documentation with Doxygen"
    cd /opt/openpose/doc && /usr/bin/doxygen /opt/openpose/doc/doc_autogeneration.doxygen
    /usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=4 "Creating directories for 'openpose_caffe'"
    /usr/bin/cmake -E make_directory /opt/openpose/3rdparty/caffe
    /usr/bin/cmake -E make_directory /opt/openpose/build/caffe/src/openpose_caffe-build
    /usr/bin/cmake -E make_directory /opt/openpose/build/caffe
    /usr/bin/cmake -E make_directory /opt/openpose/build/caffe/tmp
    /usr/bin/cmake -E make_directory /opt/openpose/build/caffe/src/openpose_caffe-stamp
    /usr/bin/cmake -E make_directory /opt/openpose/build/caffe/src
    /usr/bin/cmake -E touch /opt/openpose/build/caffe/src/openpose_caffe-stamp/openpose_caffe-mkdir
    /usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=5 "No download step for 'openpose_caffe'"
    /usr/bin/cmake -E echo_append
    /usr/bin/cmake -E touch /opt/openpose/build/caffe/src/openpose_caffe-stamp/openpose_caffe-download
    /usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=7 "No patch step for 'openpose_caffe'"
    /usr/bin/cmake -E echo_append
    /usr/bin/cmake -E touch /opt/openpose/build/caffe/src/openpose_caffe-stamp/openpose_caffe-patch
    /usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=6 "No update step for 'openpose_caffe'"
    /usr/bin/cmake -E echo_append
    /usr/bin/cmake -E touch /opt/openpose/build/caffe/src/openpose_caffe-stamp/openpose_caffe-update
    /usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=8 "Performing configure step for 'openpose_caffe'"
    cd /opt/openpose/build/caffe/src/openpose_caffe-build && /usr/bin/cmake -DCMAKE_INSTALL_PREFIX:PATH=/opt/openpose/build/caffe -DUSE_CUDNN=ON -DCUDA_ARCH_NAME=Auto -DCPU_ONLY=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_docs=OFF -DBUILD_python=OFF -DBUILD_python_layer=OFF -DUSE_LEVELDB=OFF -DUSE_LMDB=OFF -DUSE_OPENCV=OFF "-GUnix Makefiles" /opt/openpose/3rdparty/caffe
    cd /opt/openpose/build/caffe/src/openpose_caffe-build && /usr/bin/cmake -E touch /opt/openpose/build/caffe/src/openpose_caffe-stamp/openpose_caffe-configure
    /usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=9 "Performing build step for 'openpose_caffe'"
    cd /opt/openpose/build/caffe/src/openpose_caffe-build && make
    /usr/bin/cmake -E cmake_echo_color --switch= --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=1 "Built target doc_doxygen"
    make[3]: *** No targets specified and no makefile found. Stop.
    CMakeFiles/openpose_caffe.dir/build.make:110: recipe for target 'caffe/src/openpose_caffe-stamp/openpose_caffe-build' failed
    make[2]: *** [caffe/src/openpose_caffe-stamp/openpose_caffe-build] Error 2
    CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/openpose_caffe.dir/all' failed
    make[1]: *** [CMakeFiles/openpose_caffe.dir/all] Error 2
    Makefile:83: recipe for target 'all' failed
    make: *** [all] Error 2
    The command '/bin/sh -c printenv && cd opt/openpose/build && make all -n -j"$(nproc)"' returned a non-zero code: 2


    Two weird things also happen here. 1) If I run the image built so far with docker run -it openpose_image and then cd opt/openpose/build && make all -j"$(nproc)" I get the same exact error. 2) If I do instead nvidia-docker run -it openpose_image and then cd opt/openpose/build && make all -j"$(nproc)" the building runs smoothly, ending successfully without raising errors. Can somebody help me to figure out what is going on? Thanks










    share|improve this question



























      1












      1








      1








      I wrote the following Dockerfile to build an image with OpenPose (https://github.com/CMU-Perceptual-Computing-Lab/openpose)



      # Download base image
      FROM nvidia/cuda:9.0-cudnn7-devel

      # Set keyboard configuration in advance of installing CUDA
      #RUN apt-get update && apt-get install -yq keyboard-configuration

      #==========Caffe dependencies=================
      RUN apt-get --assume-yes update &&
      apt-get --assume-yes install build-essential
      libatlas-base-dev
      libprotobuf-dev
      libleveldb-dev
      libsnappy-dev
      libhdf5-serial-dev
      protobuf-compiler

      RUN apt-get --assume-yes install --no-install-recommends libboost-all-dev

      # Remaining dependencies
      RUN apt-get --assume-yes install libgflags-dev
      libgoogle-glog-dev
      liblmdb-dev

      #=========OpenCV============
      RUN apt-get update && apt-get --assume-yes install libopencv-dev
      python-opencv
      python-pip
      python-dev
      cmake
      libeigen3-dev
      doxygen

      #=========Python Libs=======
      RUN pip install --upgrade numpy
      protobuf
      opencv-python

      #=========OpenPose==========
      RUN apt-get -y install git
      RUN git clone --depth 10 https://github.com/CMU-Perceptual-Computing-Lab/openpose.git /opt/openpose
      RUN apt-get install -y cmake

      # Set environment variables
      ENV PATH "/usr/local/cuda-9.0/bin:$PATH"
      ENV LD_LIBRARY_PATH "/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH"
      ENV OPENPOSE_ROOT /opt/openpose

      RUN cd /opt/openpose &&
      mkdir -p build && cd build &&
      cmake
      -DCMAKE_BUILD_TYPE="Release"
      -DBUILD_EXAMPLES=ON
      -DBUILD_DOCS=ON
      -DBUILD_SHARED_LIBS=ON
      -DDOWNLOAD_BODY_25_MODEL=ON
      -DDOWNLOAD_BODY_COCO_MODEL=ON
      -DDOWNLOAD_BODY_MPI_MODEL=ON
      -DDOWNLOAD_HAND_MODEL=ON
      -DWITH_3D_RENDERER:BOOL=OFF
      -DBUILD_PYTHON=ON ../

      RUN printenv && cd opt/openpose/build && make all -n -j"$(nproc)"


      When building the Dockerfile with nvidia-docker build -t openpose_image . I get the following error in the last step:



      Step 14/14 : RUN printenv && cd opt/openpose/build && make all -n -j"$(nproc)"
      ---> Running in 8cbc7a731e6d
      LIBRARY_PATH=/usr/local/cuda/lib64/stubs
      HOSTNAME=8cbc7a731e6d
      LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
      HOME=/root
      CUDA_VERSION=9.0.176
      NVIDIA_REQUIRE_CUDA=cuda>=9.0
      NVIDIA_DRIVER_CAPABILITIES=compute,utility
      PATH=/usr/local/cuda-9.0/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
      CUDA_PKG_VERSION=9-0=9.0.176-1
      CUDNN_VERSION=7.4.1.5
      PWD=/
      NVIDIA_VISIBLE_DEVICES=all
      NCCL_VERSION=2.3.7
      OPENPOSE_ROOT=/opt/openpose
      /usr/bin/cmake -H/opt/openpose -B/opt/openpose/build --check-build-system CMakeFiles/Makefile.cmake 0
      /usr/bin/cmake -E cmake_progress_start /opt/openpose/build/CMakeFiles /opt/openpose/build/CMakeFiles/progress.marks
      make -f CMakeFiles/Makefile2 all
      make -f CMakeFiles/doc_doxygen.dir/build.make CMakeFiles/doc_doxygen.dir/depend
      make -f CMakeFiles/openpose_caffe.dir/build.make CMakeFiles/openpose_caffe.dir/depend
      cd /opt/openpose/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /opt/openpose /opt/openpose /opt/openpose/build /opt/openpose/build /opt/openpose/build/CMakeFiles/doc_doxygen.dir/DependInfo.cmake --color=
      make -f CMakeFiles/doc_doxygen.dir/build.make CMakeFiles/doc_doxygen.dir/build
      cd /opt/openpose/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /opt/openpose /opt/openpose /opt/openpose/build /opt/openpose/build /opt/openpose/build/CMakeFiles/openpose_caffe.dir/DependInfo.cmake --color=
      make -f CMakeFiles/openpose_caffe.dir/build.make CMakeFiles/openpose_caffe.dir/build
      /usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=1 "Generating API documentation with Doxygen"
      cd /opt/openpose/doc && /usr/bin/doxygen /opt/openpose/doc/doc_autogeneration.doxygen
      /usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=4 "Creating directories for 'openpose_caffe'"
      /usr/bin/cmake -E make_directory /opt/openpose/3rdparty/caffe
      /usr/bin/cmake -E make_directory /opt/openpose/build/caffe/src/openpose_caffe-build
      /usr/bin/cmake -E make_directory /opt/openpose/build/caffe
      /usr/bin/cmake -E make_directory /opt/openpose/build/caffe/tmp
      /usr/bin/cmake -E make_directory /opt/openpose/build/caffe/src/openpose_caffe-stamp
      /usr/bin/cmake -E make_directory /opt/openpose/build/caffe/src
      /usr/bin/cmake -E touch /opt/openpose/build/caffe/src/openpose_caffe-stamp/openpose_caffe-mkdir
      /usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=5 "No download step for 'openpose_caffe'"
      /usr/bin/cmake -E echo_append
      /usr/bin/cmake -E touch /opt/openpose/build/caffe/src/openpose_caffe-stamp/openpose_caffe-download
      /usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=7 "No patch step for 'openpose_caffe'"
      /usr/bin/cmake -E echo_append
      /usr/bin/cmake -E touch /opt/openpose/build/caffe/src/openpose_caffe-stamp/openpose_caffe-patch
      /usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=6 "No update step for 'openpose_caffe'"
      /usr/bin/cmake -E echo_append
      /usr/bin/cmake -E touch /opt/openpose/build/caffe/src/openpose_caffe-stamp/openpose_caffe-update
      /usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=8 "Performing configure step for 'openpose_caffe'"
      cd /opt/openpose/build/caffe/src/openpose_caffe-build && /usr/bin/cmake -DCMAKE_INSTALL_PREFIX:PATH=/opt/openpose/build/caffe -DUSE_CUDNN=ON -DCUDA_ARCH_NAME=Auto -DCPU_ONLY=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_docs=OFF -DBUILD_python=OFF -DBUILD_python_layer=OFF -DUSE_LEVELDB=OFF -DUSE_LMDB=OFF -DUSE_OPENCV=OFF "-GUnix Makefiles" /opt/openpose/3rdparty/caffe
      cd /opt/openpose/build/caffe/src/openpose_caffe-build && /usr/bin/cmake -E touch /opt/openpose/build/caffe/src/openpose_caffe-stamp/openpose_caffe-configure
      /usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=9 "Performing build step for 'openpose_caffe'"
      cd /opt/openpose/build/caffe/src/openpose_caffe-build && make
      /usr/bin/cmake -E cmake_echo_color --switch= --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=1 "Built target doc_doxygen"
      make[3]: *** No targets specified and no makefile found. Stop.
      CMakeFiles/openpose_caffe.dir/build.make:110: recipe for target 'caffe/src/openpose_caffe-stamp/openpose_caffe-build' failed
      make[2]: *** [caffe/src/openpose_caffe-stamp/openpose_caffe-build] Error 2
      CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/openpose_caffe.dir/all' failed
      make[1]: *** [CMakeFiles/openpose_caffe.dir/all] Error 2
      Makefile:83: recipe for target 'all' failed
      make: *** [all] Error 2
      The command '/bin/sh -c printenv && cd opt/openpose/build && make all -n -j"$(nproc)"' returned a non-zero code: 2


      Two weird things also happen here. 1) If I run the image built so far with docker run -it openpose_image and then cd opt/openpose/build && make all -j"$(nproc)" I get the same exact error. 2) If I do instead nvidia-docker run -it openpose_image and then cd opt/openpose/build && make all -j"$(nproc)" the building runs smoothly, ending successfully without raising errors. Can somebody help me to figure out what is going on? Thanks










      share|improve this question
















      I wrote the following Dockerfile to build an image with OpenPose (https://github.com/CMU-Perceptual-Computing-Lab/openpose)



      # Download base image
      FROM nvidia/cuda:9.0-cudnn7-devel

      # Set keyboard configuration in advance of installing CUDA
      #RUN apt-get update && apt-get install -yq keyboard-configuration

      #==========Caffe dependencies=================
      RUN apt-get --assume-yes update &&
      apt-get --assume-yes install build-essential
      libatlas-base-dev
      libprotobuf-dev
      libleveldb-dev
      libsnappy-dev
      libhdf5-serial-dev
      protobuf-compiler

      RUN apt-get --assume-yes install --no-install-recommends libboost-all-dev

      # Remaining dependencies
      RUN apt-get --assume-yes install libgflags-dev
      libgoogle-glog-dev
      liblmdb-dev

      #=========OpenCV============
      RUN apt-get update && apt-get --assume-yes install libopencv-dev
      python-opencv
      python-pip
      python-dev
      cmake
      libeigen3-dev
      doxygen

      #=========Python Libs=======
      RUN pip install --upgrade numpy
      protobuf
      opencv-python

      #=========OpenPose==========
      RUN apt-get -y install git
      RUN git clone --depth 10 https://github.com/CMU-Perceptual-Computing-Lab/openpose.git /opt/openpose
      RUN apt-get install -y cmake

      # Set environment variables
      ENV PATH "/usr/local/cuda-9.0/bin:$PATH"
      ENV LD_LIBRARY_PATH "/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH"
      ENV OPENPOSE_ROOT /opt/openpose

      RUN cd /opt/openpose &&
      mkdir -p build && cd build &&
      cmake
      -DCMAKE_BUILD_TYPE="Release"
      -DBUILD_EXAMPLES=ON
      -DBUILD_DOCS=ON
      -DBUILD_SHARED_LIBS=ON
      -DDOWNLOAD_BODY_25_MODEL=ON
      -DDOWNLOAD_BODY_COCO_MODEL=ON
      -DDOWNLOAD_BODY_MPI_MODEL=ON
      -DDOWNLOAD_HAND_MODEL=ON
      -DWITH_3D_RENDERER:BOOL=OFF
      -DBUILD_PYTHON=ON ../

      RUN printenv && cd opt/openpose/build && make all -n -j"$(nproc)"


      When building the Dockerfile with nvidia-docker build -t openpose_image . I get the following error in the last step:



      Step 14/14 : RUN printenv && cd opt/openpose/build && make all -n -j"$(nproc)"
      ---> Running in 8cbc7a731e6d
      LIBRARY_PATH=/usr/local/cuda/lib64/stubs
      HOSTNAME=8cbc7a731e6d
      LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
      HOME=/root
      CUDA_VERSION=9.0.176
      NVIDIA_REQUIRE_CUDA=cuda>=9.0
      NVIDIA_DRIVER_CAPABILITIES=compute,utility
      PATH=/usr/local/cuda-9.0/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
      CUDA_PKG_VERSION=9-0=9.0.176-1
      CUDNN_VERSION=7.4.1.5
      PWD=/
      NVIDIA_VISIBLE_DEVICES=all
      NCCL_VERSION=2.3.7
      OPENPOSE_ROOT=/opt/openpose
      /usr/bin/cmake -H/opt/openpose -B/opt/openpose/build --check-build-system CMakeFiles/Makefile.cmake 0
      /usr/bin/cmake -E cmake_progress_start /opt/openpose/build/CMakeFiles /opt/openpose/build/CMakeFiles/progress.marks
      make -f CMakeFiles/Makefile2 all
      make -f CMakeFiles/doc_doxygen.dir/build.make CMakeFiles/doc_doxygen.dir/depend
      make -f CMakeFiles/openpose_caffe.dir/build.make CMakeFiles/openpose_caffe.dir/depend
      cd /opt/openpose/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /opt/openpose /opt/openpose /opt/openpose/build /opt/openpose/build /opt/openpose/build/CMakeFiles/doc_doxygen.dir/DependInfo.cmake --color=
      make -f CMakeFiles/doc_doxygen.dir/build.make CMakeFiles/doc_doxygen.dir/build
      cd /opt/openpose/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /opt/openpose /opt/openpose /opt/openpose/build /opt/openpose/build /opt/openpose/build/CMakeFiles/openpose_caffe.dir/DependInfo.cmake --color=
      make -f CMakeFiles/openpose_caffe.dir/build.make CMakeFiles/openpose_caffe.dir/build
      /usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=1 "Generating API documentation with Doxygen"
      cd /opt/openpose/doc && /usr/bin/doxygen /opt/openpose/doc/doc_autogeneration.doxygen
      /usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=4 "Creating directories for 'openpose_caffe'"
      /usr/bin/cmake -E make_directory /opt/openpose/3rdparty/caffe
      /usr/bin/cmake -E make_directory /opt/openpose/build/caffe/src/openpose_caffe-build
      /usr/bin/cmake -E make_directory /opt/openpose/build/caffe
      /usr/bin/cmake -E make_directory /opt/openpose/build/caffe/tmp
      /usr/bin/cmake -E make_directory /opt/openpose/build/caffe/src/openpose_caffe-stamp
      /usr/bin/cmake -E make_directory /opt/openpose/build/caffe/src
      /usr/bin/cmake -E touch /opt/openpose/build/caffe/src/openpose_caffe-stamp/openpose_caffe-mkdir
      /usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=5 "No download step for 'openpose_caffe'"
      /usr/bin/cmake -E echo_append
      /usr/bin/cmake -E touch /opt/openpose/build/caffe/src/openpose_caffe-stamp/openpose_caffe-download
      /usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=7 "No patch step for 'openpose_caffe'"
      /usr/bin/cmake -E echo_append
      /usr/bin/cmake -E touch /opt/openpose/build/caffe/src/openpose_caffe-stamp/openpose_caffe-patch
      /usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=6 "No update step for 'openpose_caffe'"
      /usr/bin/cmake -E echo_append
      /usr/bin/cmake -E touch /opt/openpose/build/caffe/src/openpose_caffe-stamp/openpose_caffe-update
      /usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=8 "Performing configure step for 'openpose_caffe'"
      cd /opt/openpose/build/caffe/src/openpose_caffe-build && /usr/bin/cmake -DCMAKE_INSTALL_PREFIX:PATH=/opt/openpose/build/caffe -DUSE_CUDNN=ON -DCUDA_ARCH_NAME=Auto -DCPU_ONLY=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_docs=OFF -DBUILD_python=OFF -DBUILD_python_layer=OFF -DUSE_LEVELDB=OFF -DUSE_LMDB=OFF -DUSE_OPENCV=OFF "-GUnix Makefiles" /opt/openpose/3rdparty/caffe
      cd /opt/openpose/build/caffe/src/openpose_caffe-build && /usr/bin/cmake -E touch /opt/openpose/build/caffe/src/openpose_caffe-stamp/openpose_caffe-configure
      /usr/bin/cmake -E cmake_echo_color --switch= --blue --bold --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=9 "Performing build step for 'openpose_caffe'"
      cd /opt/openpose/build/caffe/src/openpose_caffe-build && make
      /usr/bin/cmake -E cmake_echo_color --switch= --progress-dir=/opt/openpose/build/CMakeFiles --progress-num=1 "Built target doc_doxygen"
      make[3]: *** No targets specified and no makefile found. Stop.
      CMakeFiles/openpose_caffe.dir/build.make:110: recipe for target 'caffe/src/openpose_caffe-stamp/openpose_caffe-build' failed
      make[2]: *** [caffe/src/openpose_caffe-stamp/openpose_caffe-build] Error 2
      CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/openpose_caffe.dir/all' failed
      make[1]: *** [CMakeFiles/openpose_caffe.dir/all] Error 2
      Makefile:83: recipe for target 'all' failed
      make: *** [all] Error 2
      The command '/bin/sh -c printenv && cd opt/openpose/build && make all -n -j"$(nproc)"' returned a non-zero code: 2


      Two weird things also happen here. 1) If I run the image built so far with docker run -it openpose_image and then cd opt/openpose/build && make all -j"$(nproc)" I get the same exact error. 2) If I do instead nvidia-docker run -it openpose_image and then cd opt/openpose/build && make all -j"$(nproc)" the building runs smoothly, ending successfully without raising errors. Can somebody help me to figure out what is going on? Thanks







      docker dockerfile nvidia-docker openpose






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '18 at 14:38









      talonmies

      59.8k17132199




      59.8k17132199










      asked Nov 23 '18 at 14:36









      Gianluca John MassimianiGianluca John Massimiani

      1017




      1017
























          0






          active

          oldest

          votes












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53448644%2fmake-all-jnproc-command-works-within-docker-container-but-not-in-dockerfi%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53448644%2fmake-all-jnproc-command-works-within-docker-container-but-not-in-dockerfi%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          Xamarin.form Move up view when keyboard appear

          Post-Redirect-Get with Spring WebFlux and Thymeleaf

          Anylogic : not able to use stopDelay()