Error docker build OpenCV from source

I am using the following docker file to build OpenCV from source on Jetson Xavier. However, I receive an error. Could you please let me know what changes do I need to make to get this running?

FROM jetson-cudnn8:latest

ARG DEBIAN_FRONTEND=noninteractive

# System update
RUN apt-get clean && apt-get update && apt-get install -y --no-install-recommends\
        libgstreamer1.0-0 \
        gstreamer1.0-plugins-base \
        gstreamer1.0-plugins-good \
        gstreamer1.0-plugins-bad \
        gstreamer1.0-plugins-ugly \
        gstreamer1.0-libav \
        gstreamer1.0-doc \
        gstreamer1.0-tools \
        libgstreamer1.0-dev \
        libgstreamer-plugins-base1.0-dev \
        libdc1394-22-dev \
        libavc1394-dev libavcodec-dev libavformat-dev libswscale-dev libavresample-dev \
        libxvidcore-dev x264 libx264-dev libfaac-dev libmp3lame-dev libtheora-dev  \
	python3-pip \
 && rm -rf /var/lib/apt/lists/*

RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10
RUN pip3 install cython>=0.29.21 setuptools
RUN pip3 install --upgrade --force-reinstall numpy

RUN git clone https://github.com/opencv/opencv.git --branch 4.5.4 --single-branch && \
    git clone https://github.com/opencv/opencv_contrib.git --branch 4.5.4 --single-branch && \
    cd opencv && \
    mkdir build && \
    cd build && \
    cmake -D CMAKE_BUILD_TYPE=Release -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules/ -DBUILD_opencv_legacy=OFF \
    -D CMAKE_C_COMPILER=gcc-7 -D CMAKE_CXX_COMPILER=g++-7\
    -D CUDA_ARCH_BIN="5.3 6.2 7.2 7.5"\
    -D CUDA_ARCH_PTX="5.3" \
    -D CUDNN_VERSION="8.0" \
    -D WITH_TBB=ON \
    -D OPENCV_ENABLE_NONFREE=ON \
    -D ENABLE_FAST_MATH=1 \
    -D CUDA_FAST_MATH=1 \
    -D WITH_CUDA=ON \
    -D OPENCV_DNN_CUDA=ON \
    -D WITH_CUBLAS=ON \
    -D BUILD_EXAMPLES=OFF -D BUILD_opencv_apps=OFF -D BUILD_DOCS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF \
    -D OPENCV_GENERATE_PKGCONFIG=ON \
    -DCMAKE_INSTALL_PREFIX=/usr/local ../ && \
    make -j $(nproc)  && \
    make install && \
    rm -rf /opencv /opencv_contrib

RUN echo "/usr/local/lib" >> /etc/ld.so.conf.d/opencv.conf && ldconfig -v
RUN pip3 install wheel

ARG DEBIAN_FRONTEND=noninteractive

# System update
RUN apt-get clean && apt-get update && apt-get install -y --no-install-recommends\
        build-essential \
        cmake \
        git \
        wget \
        unzip \
        yasm \
        pkg-config \
        libtool \
        nasm \
        automake \
        libpng-dev \
        libjpeg-turbo8-dev \
        libssl-dev \
        liblapack-dev \
        libatlas-base-dev \
        python3.7 \
        python3.7-dev \
        python3-distutils \
        libpython3-dev \
        python3-pip \
        python3-numpy \
        libeigen3-dev \
        libjpeg-dev \
        python3-setuptools \
	    libxmu-dev \
	    libxi-dev \
        python3-zmq \
        python3-protobuf \
        gnupg1 gnupg2 \
 && rm -rf /var/lib/apt/lists/*

COPY ./trusted.gpg /etc/apt/
COPY ./jetson-ota-public.asc /etc/apt/trusted.gpg.d/
RUN apt-key add /etc/apt/trusted.gpg && apt-key add /etc/apt/trusted.gpg.d/jetson-ota-public.asc
COPY ./nvidia-l4t-apt-source.list /etc/apt/sources.list.d/

RUN apt-get clean && apt-get update && apt upgrade -y && apt-get install -y --no-install-recommends\
	libcudnn8 \
	libcudnn8-dev \
	libcublas-dev \
	cuda-cufft-dev-10-2 \
    cuda-npp-dev-10-2 \
    cuda-nvcc-10-2 \
    libcublas-dev \
    cuda-compiler-10-2 \
    cuda-cudart-dev-10-2 \
    cuda-cupti-dev-10-2 \
    cuda-curand-dev-10-2 \
    cuda-cusolver-dev-10-2 \
    cuda-cusparse-dev-10-2 \
    cuda-libraries-dev-10-2 \
    cuda-misc-headers-10-2 \
    cuda-nvml-dev-10-2

RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10

The error is:

 ---> Running in 5d507f5234b4
failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: error adding seccomp filter rule for syscall clone3: permission denied: unknown
ERROR: Service 'opencv_python3.6' failed to build : Build failed```

Hi,

Could you share more information about the jetson-cudnn8 container?
In general, it’s more recommended to use the containers that in our NGC server:

Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.