Is it possible to create docker image for DeepStream 6.3 from jetson nano?

Description

I want to create a Docker image for DeepStream 6.3, which I intend to run on L4T 35.4.1. However, I’m facing an issue because I cannot develop or create the Docker image directly on L4T 35.4.1, as I only have access to a Jetson Nano, which supports L4T versions up to 32.7.4. Previously, I was developing and creating my system to run on DeepStream 6.0.1, and it worked fine.

Now, I am developing my algorithm on a dGPU that supports DeepStream 6.3, and I want to deploy it using Jetson Nano running L4T 32.7.4 by creating a Dockerfile that installs DeepStream 6.3 and the necessary Python dependencies. This Docker image will then be pulled onto a Jetson Xavier, which is running L4T 35.4.1.

I have tried using the multi-architecture Docker provided by NVIDIA, but the resultant image is too large (27GB), which is not suitable for my needs. I am also unable to build the Docker image for DeepStream 6.3 on the Jetson Nano running L4T 32.7.4. The Dockerfile I wrote, using multiple sources, fails at the step where I try to get the apt key for the NVIDIA repository to download VPI.

Could you please guide me on whether this is possible, and if so, what changes I should make? Additionally, I would like to use Python apps for DeepStream.

ARG BASE_IMAGE=nvcr.io/nvidia/l4t-base:35.4.1
FROM ${BASE_IMAGE}

ENV DEBIAN_FRONTEND=noninteractive \
    QT_X11_NO_MITSHM=1 \
    DISPLAY=:0

ENV PATH="/usr/local/cuda/bin:${PATH}"
ENV LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}"

RUN apt-get update && \
    apt-get install -y --no-install-recommends gnupg && \
    apt-key adv --fetch-keys https://apt.kitware.com/keys/kitware-archive-latest.asc && \
    apt-get update && \
    apt-get install -y --no-install-recommends \
        cmake \
        python3-dev \
        python3-pip \
        python3-distutils \
        python3-wheel \
        python3-setuptools \
        libpng-dev \
        libatlas3-base \
        libtbb2 \
        libtiff-dev \
        libfreetype6-dev \
        libsqlite3-dev \
        libavcodec-dev \
        libavformat-dev \
        libavresample-dev \
        libcanberra-gtk3-module \
        libdc1394-22-dev \
        libeigen3-dev \
        libglew-dev \
        libgtk-3-dev \
        liblapack-dev \
        liblapacke-dev \
        libpostproc-dev \
        libswscale-dev \
        libtbb-dev \
        libv4l-dev \
        libxine2-dev \
        libxvidcore-dev \
        libx264-dev \
        libgtkglext1 \
        libgtkglext1-dev \
        pkg-config \
        qv4l2 \
        v4l-utils \
        m4 \
        g++ \
        autoconf \
        automake \
        git \
        gfortran \
        libgirepository1.0-dev \
        libcairo2-dev \
        libopenblas-dev \
        libopenmpi-dev \
        rsyslog \
        tzdata \
        libglib2.0-0 \
        libjson-glib-1.0-0 \
        librabbitmq4 \
        gstreamer1.0-rtsp \
        libyaml-cpp0.6 \
        libjsoncpp-dev \
        libcurl4-openssl-dev \
        wget \
        ca-certificates \
        openssl \
        openmpi-bin \
        libomp-dev \
        libssl1.1 \
        libgstreamer1.0-0 \
        gstreamer1.0-tools \
        gstreamer1.0-plugins-good \
        gstreamer1.0-plugins-bad \
        gstreamer1.0-plugins-ugly \
        gstreamer1.0-libav \
        libgstreamer-plugins-base1.0-dev \
        libgstrtspserver-1.0-0 \
        libjansson4 \
        libyaml-cpp-dev \
    && rm -rf /var/lib/apt/lists/* \
    && apt-get clean

# public repo
RUN apt-key adv --fetch-key https://repo.download.nvidia.com/jetson-ota-public.asc
# RUN wget -O - https://repo.download.nvidia.com/jetson/jetson-archive-keyring.gpg | apt-key add - && \
#     echo "deb https://repo.download.nvidia.com/jetson/common r35.1 main" > /etc/apt/sources.list.d/nvidia-l4t-apt-source.list && \
#     echo "deb https://repo.download.nvidia.com/jetson/t194 r35.1 main" >> /etc/apt/sources.list.d/nvidia-l4t-apt-source.list && \
#     apt-get update
#ADD https://repo.download.nvidia.com/jetson/common/pool/main/libn/libnvvpi1/libnvvpi1_1.0.15_arm64.deb /root
# ADD https://repo.download.nvidia.com/jetson/common/pool/main/v/vpi-dev/vpi-dev_2.3.9_arm64.deb /root
# ADD https://repo.download.nvidia.com/jetson/common/pool/main/v/vpi-lib/vpi-lib_2.3.9_arm64.deb /root

ADD vpi-dev-2.3.9-aarch64-l4t.deb              /root
ADD vpi-lib-2.3.9-aarch64-l4t.deb              /root
#RUN dpkg -X /root/libnvvpi1_1.0.15_arm64.deb /


RUN mkdir -p /lib/firmware



RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
/root/vpi-dev-2.3.9-aarch64-l4t.deb \
/root/vpi-lib-2.3.9-aarch64-l4t.deb && \
rm -rf /var/lib/apt/lists/* && \
rm -f /root/vpi-dev-2.3.9-aarch64-l4t.deb /root/vpi-lib-2.3.9-aarch64-l4t.deb && \
apt autoremove

RUN ldconfig

EXPOSE 5000
WORKDIR /opt


#Python Packages
#ARG PILLOW_VERSION=pillow<7
RUN pip3 install --no-cache-dir setuptools Cython wheel && \
    #pip3 install 'https://github.com/jetson-nano-wheels/python3.6-numpy-1.19.4/releases/download/v0.0.1/numpy-1.19.4-cp36-cp36m-linux_aarch64.whl' && \
    #pip3 install --no-cache-dir pycuda six && \
    pip3 install flask pysqlite3 scipy \
    #'https://github.com/jetson-nano-wheels/python3.6-scipy-1.5.4/releases/download/v0.0.1/scipy-1.5.4-cp36-cp36m-linux_aarch64.whl' \
    shapely requests passlib \
    PyJWT && \
    #pip3 install --no-cache-dir "${PILLOW_VERSION}" && \
    pip3 install Flask-Cors --no-dependencies && \
    pip3 install six getmac psutil && \
    pip3 install -U pip && \
    pip3 install azure-iot-device azure-storage-file-datalake azure-identity numpy==1.23.0 opencv-python==4.9.0.80\
    PyYAML
    
COPY deepstream_sdk_v6.3.0_jetson.tbz2 /opt/

RUN tar -xvf deepstream_sdk_v6.3.0_jetson.tbz2 -C / && \
    cd /opt/nvidia/deepstream/deepstream-6.3 && ./install.sh && \
    ldconfig && cd /opt && rm deepstream_sdk_v6.3.0_jetson.tbz2 \
    rm -rf /opt/nvidia/deepstream/deepstream-6.3/samples && \
    rm -rf /opt/nvidia/deepstream/deepstream-6.3/sources && \
    rm -rf /opt/nvidia/deepstream/deepstream-6.3/doc     && \
    rm -rf /opt/nvidia/deepstream/deepstream-6.3/bin     && \
    rm /opt/nvidia/deepstream/deepstream-6.3/install.sh  && \
    rm /opt/nvidia/deepstream/deepstream-6.3/LICENSE.txt && \
    rm /opt/nvidia/deepstream/deepstream-6.3/LicenseAgreement.pdf && \
    rm /opt/nvidia/deepstream/deepstream-6.3/README      && \
    rm /opt/nvidia/deepstream/deepstream-6.3/uninstall.sh && \
    rm /opt/nvidia/deepstream/deepstream-6.3/version

COPY user_deepstream_python_apps_install.sh /opt/
COPY user_additional_install.sh /opt/

RUN ./user_deepstream_python_apps_install.sh --version 1.1.8
RUN ./user_additional_install.sh

COPY ./adlytic-edge-devices-ai-backend .

#CMD ["mount"]

CMD ["bash", "./pipeline.sh"]

I wrote another Dockerfile by modifying the one I was using for DeepStream 6.0.1, but it fails at the step where Python-GST is being installed. with error something like not finding python while autogen and configure step. Dockerfile for this is below.

ARG BASE_IMAGE=nvcr.io/nvidia/l4t-base:35.4.1
FROM ${BASE_IMAGE}

ENV DEBIAN_FRONTEND=noninteractive \
    QT_X11_NO_MITSHM=1 \
    DISPLAY=:0
ENV PATH="/usr/local/cuda/bin:${PATH}"
ENV LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}"


# Update and install required packages
RUN apt-get update && \
    apt-get install -y --no-install-recommends gnupg && \
    apt-key adv --fetch-keys https://apt.kitware.com/keys/kitware-archive-latest.asc && \
    apt-get update && \
    apt-get install -y --no-install-recommends \
        cmake \
        python3-distutils \
        python3-wheel \
        libpng-dev \
        libatlas3-base \
        libtbb2 \
        libtesseract4 \
        libtiff-dev \
        libfreetype6-dev \
        libsqlite3-dev \
        libavcodec-dev \
        libavformat-dev \
        libavresample-dev \
        libcanberra-gtk3-module \
        libdc1394-22-dev \
        libeigen3-dev \
        libglew-dev \
        libgstreamer-plugins-base1.0-dev \
        libgstreamer-plugins-good1.0-dev \
        libgstreamer1.0-dev \
        libgtk-3-dev \
        liblapack-dev \
        liblapacke-dev \
        libpostproc-dev \
        libswscale-dev \
        libtbb-dev \
        libv4l-dev \
        libxine2-dev \
        libxvidcore-dev \
        libx264-dev \
        libgtkglext1 \
        libgtkglext1-dev \
        pkg-config \
        qv4l2 \
        v4l-utils \
        #v4l2ucp \
        libgeos-dev \
        libssl-dev \
        gstreamer1.0-tools \
        gstreamer1.0-plugins-good \
        gstreamer1.0-plugins-bad \
        gstreamer1.0-plugins-ugly \
        gstreamer1.0-libav \
        libgstrtspserver-1.0-0 \
        libjansson4 \
        libjansson-dev \
        git \
        python3-dev \
        python3-pip \
        g++ \
        build-essential \
        libglib2.0-dev \
        libglib2.0-dev-bin \
        python-gi-dev \
        libtool \
        m4 \
        autoconf \
        automake \
        libgirepository1.0-dev \
        libcairo2-dev \
        librdkafka-dev \
        libopenblas-dev \
        libopenmpi-dev \
        openmpi-bin \
        gfortran \
        libomp-dev \
    && rm -rf /var/lib/apt/lists/* \
    && apt-get clean




#OPENCV
#COPY opencv4/ .
#RUN apt-get install -y --no-install-recommends  \
#	./OpenCV-4.5.0-aarch64-main.deb  \
#	./OpenCV-4.5.0-aarch64-licenses.deb  \
#	./OpenCV-4.5.0-aarch64-libs.deb   \
#	./OpenCV-4.5.0-aarch64-dev.deb   \
#	./OpenCV-4.5.0-aarch64-python.deb   \
#	./OpenCV-4.5.0-aarch64-scripts.deb  \
#	&& rm -rf /var/lib/apt/lists/* \
#  	&& apt-get clean && \
#    rm -rf ./*.deb


EXPOSE 5000
WORKDIR /opt


#Python Packages
#ARG PILLOW_VERSION=pillow<7
RUN pip3 install --no-cache-dir setuptools Cython wheel && \
    #pip3 install 'https://github.com/jetson-nano-wheels/python3.6-numpy-1.19.4/releases/download/v0.0.1/numpy-1.19.4-cp36-cp36m-linux_aarch64.whl' && \
    #pip3 install --no-cache-dir pycuda six && \
    pip3 install flask pysqlite3 scipy \
    #'https://github.com/jetson-nano-wheels/python3.6-scipy-1.5.4/releases/download/v0.0.1/scipy-1.5.4-cp36-cp36m-linux_aarch64.whl' \
    shapely requests passlib \
    PyJWT && \
    #pip3 install --no-cache-dir "${PILLOW_VERSION}" && \
    pip3 install Flask-Cors --no-dependencies && \
    pip3 install six getmac psutil && \
    pip3 install -U pip && \
    pip3 install azure-iot-device azure-storage-file-datalake azure-identity numpy==1.23.0 opencv-python==4.9.0.80\
    PyYAML



#RUN git clone https://github.com/edenhill/librdkafka.git && \
#    cd librdkafka && git reset --hard 7101c2310341ab3f4675fc565f64f0967e135a6a && \
#    ./configure && make && make install && cd /opt && rm -rf librdkafka

#RUN mkdir -p /opt/nvidia/deepstream/deepstream-6.3/lib && \
#    cp /usr/local/lib/librdkafka* /opt/nvidia/deepstream/deepstream-6.3/lib

# RUN wget -o libgstvideo-1.0.so.0.1405.0 https://developer.nvidia.com/libgstvideo-10so014050 && \
#     cp ./libgstvideo-1.0.so.0.1405.0 /usr/lib/aarch64-linux-gnu/libgstvideo-1.0.so.0.1405.0

ADD https://repo.download.nvidia.com/jetson/common/pool/main/libn/libnvvpi1/libnvvpi1_1.0.15_arm64.deb /root
ADD https://repo.download.nvidia.com/jetson/common/pool/main/v/vpi1-dev/vpi1-dev_1.0.15_arm64.deb /root

RUN dpkg -X /root/libnvvpi1_1.0.15_arm64.deb /

RUN dpkg -X /root/vpi1-dev_1.0.15_arm64.deb /

RUN rm /root/libnvvpi1_1.0.15_arm64.deb  \
      /root/vpi1-dev_1.0.15_arm64.deb

RUN ldconfig


COPY deepstream_sdk_v6.3.0_jetson.tbz2 /opt/

RUN tar -xvf deepstream_sdk_v6.3.0_jetson.tbz2 -C / && \
    cd /opt/nvidia/deepstream/deepstream-6.3 && ./install.sh && \
    ldconfig && cd /opt && rm deepstream_sdk_v6.3.0_jetson.tbz2 \
    rm -rf /opt/nvidia/deepstream/deepstream-6.3/samples && \
    rm -rf /opt/nvidia/deepstream/deepstream-6.3/sources && \
    rm -rf /opt/nvidia/deepstream/deepstream-6.3/doc     && \
    rm -rf /opt/nvidia/deepstream/deepstream-6.3/bin     && \
    rm /opt/nvidia/deepstream/deepstream-6.3/install.sh  && \
    rm /opt/nvidia/deepstream/deepstream-6.3/LICENSE.txt && \
    rm /opt/nvidia/deepstream/deepstream-6.3/LicenseAgreement.pdf && \
    rm /opt/nvidia/deepstream/deepstream-6.3/README      && \
    rm /opt/nvidia/deepstream/deepstream-6.3/uninstall.sh && \
    rm /opt/nvidia/deepstream/deepstream-6.3/version

# RUN apt-get update && apt-get install python3-gi python3-dev python-gi-dev git \
#     python3 python3-pip python3.8-dev cmake g++ build-essential libglib2.0-dev \
#     libglib2.0-dev-bin libgstreamer1.0-dev libtool m4 autoconf automake libgirepository1.0-dev libcairo2-dev \
#     libssl1.1 libgstreamer1.0-0 gstreamer1.0-tools gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
#     gstreamer1.0-libav libgstreamer-plugins-base1.0-dev libgstrtspserver-1.0-0 libjansson4 -y
    
# RUN pip3 install PyGObject


# RUN apt-get update && apt-get install python3-gi python3-dev python3-gst-1.0 python-gi-dev git \
#     python3 python3-pip python3.8-dev cmake g++ build-essential libglib2.0-dev \
#     libglib2.0-dev-bin libgstreamer1.0-dev libtool m4 autoconf automake libgirepository1.0-dev libcairo2-dev \
#     libssl1.1 libgstreamer1.0-0 gstreamer1.0-tools gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
#     gstreamer1.0-libav libgstreamer-plugins-base1.0-dev libgstrtspserver-1.0-0 libjansson4 libyaml-cpp-dev libjsoncpp-dev protobuf-compiler -y
    
# RUN pip3 install PyGObject


ENV GST_LIBS="-lgstreamer-1.0 -lgobject-2.0 -lglib-2.0"
ENV GST_CFLAGS="-pthread -I/usr/include/gstreamer-1.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include"

RUN git clone https://github.com/GStreamer/gst-python.git && \
    cd gst-python && git checkout 1a8f48a && \
    ./autogen.sh && \
    ./configure && \
    make && make install &


RUN wget -O pyds-1.1.8-py3-none-linux_aarch64.whl https://github.com/NVIDIA-AI-IOT/deepstream_python_apps/releases/download/v1.1.8/pyds-1.1.8-py3-none-linux_aarch64.whl && \
    pip3 install ./pyds-1.1.8-py3-none*.whl && cd /opt && rm pyds-1.1.8-py3-none-linux_aarch64.whl

# RUN git clone https://github.com/ifzhang/ByteTrack.git && cd /opt/ByteTrack/deploy/DeepStream && mkdir build && cd build && cmake .. && make ByteTracker

# RUN cp /opt/ByteTrack/deploy/DeepStream/lib/libByteTracker.so /opt/nvidia/deepstream/deepstream/lib/libByteTracker.so

COPY ./adlytic-edge-devices-ai-backend .

#CMD ["mount"]

CMD ["bash", "./pipeline.sh"]



Thanks for your help. I really appreciate it. excuse my English :-)

Hi @aqib.riaz ,
I would recommend you raising this issue to Deepstream or Jetson Forum for better assistance, As this forum talks about issues specific to TensorRT.

Thanks