Docker Containers

DeepStream 6.0.1 provides Docker containers for both dGPU and Jetson platforms. These containers provide a convenient, out-of-the-box way to deploy DeepStream applications by packaging all associated dependencies within the container. The associated Docker images are hosted on the NVIDIA container registry in the NGC web portal at https://ngc.nvidia.com. They use the nvidia-docker package, which enables access to the required GPU resources from containers. This section describes the features supported by the DeepStream Docker container for the dGPU and Jetson platforms.

Note

The DeepStream 6.0.1 containers for dGPU and Jetson are distinct, so you must get the right image for your platform.

A Docker Container for dGPU

The Containers page in the NGC web portal gives instructions for pulling and running the container, along with a description of its contents. The dGPU container is called deepstream and the Jetson container is called deepstream-l4t. Unlike the container in DeepStream 3.0, the dGPU DeepStream 6.0.1 container supports DeepStream application development within the container. It contains the same build tools and development libraries as the DeepStream 6.0.1 SDK. In a typical scenario, you build, execute and debug a DeepStream application within the DeepStream container. Once your application is ready, you can use the DeepStream 6.0.1 container as a base image to create your own Docker container holding your application files (binaries, libraries, models, configuration file, etc.,). Here is an example snippet of Dockerfile for creating your own Docker container:

# Replace with required container type e.g. base, devel etc in the following line
FROM nvcr.io/nvidia/deepstream:6.0.1-<container type>
COPY myapp  /root/apps/myapp
# To get video driver libraries at runtime (libnvidia-encode.so/libnvcuvid.so)
ENV NVIDIA_DRIVER_CAPABILITIES $NVIDIA_DRIVER_CAPABILITIES,video

This Dockerfile copies your application (from directory mydsapp) into the container (pathname /root/apps). Note that you must ensure the DeepStream 6.0.1 image location from NGC is accurate.

Table below lists the docker containers for dGPU released with DeepStream 6.0.1:

Docker Containers for dGPU

Container

Container pull commands

base docker (contains only the runtime libraries and GStreamer plugins. Can be used as a base to build custom dockers for DeepStream applications)

docker pull nvcr.io/nvidia/deepstream:6.0.1-base

devel docker (contains the entire SDK along with a development environment for building DeepStream applications and graph composer)

docker pull nvcr.io/nvidia/deepstream:6.0.1-devel

Triton Inference Server docker with Triton Inference Server and dependencies installed along with a development environment for building DeepStream applications

docker pull nvcr.io/nvidia/deepstream:6.0.1-triton

DeepStream IoT docker with deepstream-test5-app installed and all other reference applications removed

docker pull nvcr.io/nvidia/deepstream:6.0.1-iot

DeepStream samples docker (contains the runtime libraries, GStreamer plugins, reference applications and sample streams, models and configs)

docker pull nvcr.io/nvidia/deepstream:6.0.1-samples

See the DeepStream 6.0.1 Release Notes for information regarding nvcr.io authentication and more.

Note

See the dGPU container on NGC for more details and instructions to run the dGPU containers.

A Docker Container for Jetson

As of JetPack release 4.2.1, NVIDIA Container Runtime for Jetson has been added, enabling you to run GPU-enabled containers on Jetson devices. Using this capability, DeepStream 6.0.1 can be run inside containers on Jetson devices using Docker images on NGC. Pull the container and execute it according to the instructions on the NGC Containers page. The DeepStream container expects CUDA, TensorRT, and VisionWorks to be installed on the Jetson device, because it is mounted within the container from the host. Make sure that these utilities are installed using JetPack on your Jetson prior to launching the DeepStream container. The Jetson Docker containers are for deployment only. They do not support DeepStream software development within a container. You can build applications natively on the Jetson target and create containers for them by adding binaries to your docker images. Alternatively, you can generate Jetson containers from your workstation using instructions in the Building Jetson Containers on an x86 Workstation section in the NVIDIA Container Runtime for Jetson documentation. The table below lists the docker containers for Jetson released with DeepStream 6.0.1:

Docker Containers for Jetson

Container

Container pull commands

Base docker (contains only the runtime libraries and GStreamer plugins. Can be used as a base to build custom dockers for DeepStream applications)

docker pull nvcr.io/nvidia/deepstream-l4t:6.0.1-base

DeepStream IoT docker with deepstream-test5-app installed and all other reference applications removed.

docker pull nvcr.io/nvidia/deepstream-l4t:6.0.1-iot

DeepStream samples docker (contains the runtime libraries, GStreamer plugins, reference applications and sample streams, models and configs)

docker pull nvcr.io/nvidia/deepstream-l4t:6.0.1-samples

DeepStream Triton docker (contains contents of the samples docker plus devel libraries and Triton Inference Server backends)

docker pull nvcr.io/nvidia/deepstream-l4t:6.0.1-triton

See the DeepStream 6.0.1 Release Notes for information regarding nvcr.io authentication and more.

Note

See the Jetson container on NGC for more details and instructions to run the Jetson containers.

Creating custom DeepStream docker for dGPU using DeepStreamSDK package

Following is the sample Dockerfile to create custom DeepStream docker for dGPU using either DeepStream debian or tar package:

# Set CUDA_VERSION, example: 11.4.1
ARG CUDA_VERSION
# Use CUDAGL base devel docker
FROM nvcr.io/nvidia/cudagl:${CUDA_VERSION}-devel-ubuntu18.04

# Set TENSORRT_VERSION, example: 8.0.1-1+cuda11.4
ARG TENSORRT_VERSION
# Set CUDNN_VERSION, example: 8.2.1.32-1+cuda11.4
ARG CUDNN_VERSION

# Install dependencies
RUN apt-get update && \
      DEBIAN_FRONTEND=noninteractive      apt-get install -y --no-install-recommends \
      linux-libc-dev \
      libglew2.0 libssl1.0.0 libjpeg8 libjson-glib-1.0-0 \
      gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-tools gstreamer1.0-libav \
      gstreamer1.0-alsa \
      libcurl3 \
      libcurl3-gnutls \
      libuuid1 \
      libjansson4 \
      libjansson-dev \
      librabbitmq4 \
      libgles2-mesa \
      libgstrtspserver-1.0-0 \
      libv4l-dev \
      gdb bash-completion libboost-dev \
      uuid-dev libgstrtspserver-1.0-0 libgstrtspserver-1.0-0-dbg libgstrtspserver-1.0-dev \
      libgstreamer1.0-dev \
      libgstreamer-plugins-base1.0-dev \
      libglew-dev \
      libssl-dev \
      libopencv-dev \
      freeglut3-dev \
      libjpeg-dev \
      libcurl4-gnutls-dev \
      libjson-glib-dev \
      libboost-dev \
      librabbitmq-dev \
      libgles2-mesa-dev libgtk-3-dev libgdk3.0-cil-dev \
      pkg-config \
      libxau-dev \
      libxdmcp-dev \
      libxcb1-dev \
      libxext-dev \
      libx11-dev \
      git \
      rsyslog \
      vim  \
      gstreamer1.0-rtsp \
      libcudnn8=${CUDNN_VERSION} \
      libcudnn8-dev=${CUDNN_VERSION} \
      libnvinfer8=${TENSORRT_VERSION} \
      libnvinfer-dev=${TENSORRT_VERSION} \
      libnvparsers8=${TENSORRT_VERSION} \
      libnvparsers-dev=${TENSORRT_VERSION} \
      libnvonnxparsers8=${TENSORRT_VERSION} \
      libnvonnxparsers-dev=${TENSORRT_VERSION} \
      libnvinfer-plugin8=${TENSORRT_VERSION} \
      libnvinfer-plugin-dev=${TENSORRT_VERSION} \
      python-libnvinfer=${TENSORRT_VERSION} \
      python3-libnvinfer=${TENSORRT_VERSION} \
      python-libnvinfer-dev=${TENSORRT_VERSION} \
      python3-libnvinfer-dev=${TENSORRT_VERSION} && \
      rm -rf /var/lib/apt/lists/* && \
      apt autoremove


# Install DeepStreamSDK using debian package. DeepStream tar package can also be installed in a similar manner
ADD deepstream-6.0_6.0.1-1_amd64.deb /root

RUN apt-get update && \
      DEBIAN_FRONTEND=noninteractive  apt-get install -y --no-install-recommends \
      /root/deepstream-6.0_6.0.1-1_amd64.deb

WORKDIR /opt/nvidia/deepstream/deepstream

RUN ln -s /usr/lib/x86_64-linux-gnu/libnvcuvid.so.1 /usr/lib/x86_64-linux-gnu/libnvcuvid.so
RUN ln -s /usr/lib/x86_64-linux-gnu/libnvidia-encode.so.1 /usr/lib/x86_64-linux-gnu/libnvidia-encode.so

Build docker using the following command:

docker build -t deepstream:dgpu --build-arg TENSORRT_VERSION="8.0.1-1+cuda11.4" --build-arg CUDNN_VERSION="8.0.1.32-1+cuda11.4" --build-arg CUDA_VERSION="11.4.1" .

Note

Ensure Dockerfile and DS package is present in the directory used to build the docker.

Creating custom DeepStream docker for Jetson using DeepStreamSDK package

Following is the sample Dockerfile to create custom DeepStream docker for Jetson using tar package:

# Set L4T_VERSION, example: 10.2
ARG L4T_VERSION
# Use L4T base docker listed on https://catalog.ngc.nvidia.com/orgs/nvidia/containers/l4t-base/tags
FROM nvcr.io/nvidia/l4t-base:${L4T_VERSION}

# Install dependencies
RUN apt-get update && \
      DEBIAN_FRONTEND=noninteractive      apt-get install -y --no-install-recommends \
      rsyslog git \
           tzdata \
           libgstrtspserver-1.0-0 \
           libjansson4 \
           libglib2.0 \
           libjson-glib-1.0-0 \
           librabbitmq4 \
           gstreamer1.0-rtsp \
           libcurl4-openssl-dev ca-certificates

#Install libnvvpi1 and vpi1-dev
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

# Install DeepStreamSDK using tar package.
ENV DS_REL_PKG deepstream_sdk_v6.0.1_jetson.tbz2

COPY "${DS_REL_PKG}"  \
/

RUN DS_REL_PKG_DIR="${DS_REL_PKG%.tbz2}" && \
cd / && \
tar -xvf "${DS_REL_PKG}" -C / && \
cd /opt/nvidia/deepstream/deepstream && \
./install.sh && \
cd / && \
rm -rf "/${DS_REL_PKG}"

RUN ldconfig

CMD ["/bin/bash"]
WORKDIR /opt/nvidia/deepstream/deepstream

ENV LD_LIBRARY_PATH /usr/local/cuda-10.2/lib64
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES all

Build docker using the following command:

docker build -t deepstream:jetson --build-arg L4T_VERSION="r32.7.1" .

Note

Ensure Dockerfile and DS package is present in the directory used to build the docker. Also, docker can be created using DeepStream tar package only, not debian.