Docker Containers ================== DeepStream 6.3 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.3 containers for dGPU and Jetson are distinct, so you must get the right image for your platform. .. note:: With DS 6.3, DeepStream docker containers do not package libraries necessary for certain multimedia operations like audio data parsing, CPU decode, and CPU encode. This change could affect processing certain video streams/files like mp4 that include audio track. Run the below script inside the docker images to install additional packages (e.g. `gstreamer1.0-libav`, g`streamer1.0-plugins-good`, `gstreamer1.0-plugins-bad`, `gstreamer1.0-plugins-ugly` as required) that might be necessary to use all of the DeepStreamSDK features: ``/opt/nvidia/deepstream/deepstream/user_additional_install.sh`` Prerequisites ~~~~~~~~~~~~~~~~ 1. Install :code:`docker-ce` by following the `official instructions`_. .. _official instructions: https://docs.docker.com/engine/install Once you have installed `docker-ce`, follow the `post-installation steps`_ to ensure that the docker can be run without :code:`sudo`. .. _post-installation steps: https://docs.docker.com/engine/install/linux-postinstall/ 2. Install :code:`nvidia-container-toolkit` by following the `install-guide`_. .. _install-guide: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html 3. Get an `NGC`_ account and API key: a. Go to NGC and search the **DeepStream** in the **Container** tab. This message is displayed: "Sign in to access the PULL feature of this repository". b. Enter your Email address and click **Next**, or click **Create an Account**. c. Choose your organization when prompted for **Organization/Team**. d. Click **Sign In**. .. _NGC: https://ngc.nvidia.com/ 4. Log in to the NGC docker registry (:code:`nvcr.io`) using the command :code:`docker login nvcr.io` and enter the following credentials: .. code:: bash a. Username: "$oauthtoken" b. Password: "YOUR_NGC_API_KEY" where :code:`YOUR_NGC_API_KEY` corresponds to the key you generated from step 3. Sample commands to run a docker container: :: # Pull the required docker. Refer Docker Containers table to get docker container name. $ docker pull # Step to run the docker $ export DISPLAY=:0 $ xhost + $ docker run -it --rm --net=host --gpus all -e DISPLAY=$DISPLAY --device /dev/snd -v /tmp/.X11-unix/:/tmp/.X11-unix 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.3 container supports DeepStream application development within the container. It contains the same build tools and development libraries as the DeepStream 6.3 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.3 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.3- 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.3 image location from NGC is accurate. Table below lists the docker containers for dGPU released with DeepStream 6.3: .. csv-table:: Docker Containers for dGPU :file: ../text/tables/docker tables/DS_docker_container_list.csv :widths: 20, 30 :header-rows: 1 See the `DeepStream 6.3 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.3 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 no longer expects CUDA, TensorRT to be installed on the Jetson device, because it is included within the container image. Make sure that the BSP is installed using JetPack and nvidia-container tools installed from Jetpack or apt server (See instructions below) 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.3: .. csv-table:: Docker Containers for Jetson :file: ../text/tables/docker tables/DS_docker_container_jetson_list.csv :widths: 25, 35 :header-rows: 1 See the `DeepStream 6.3 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 dockers for dGPU or Jetson using DeepStreamSDK package --------------------------------------------------------------------------------- .. note:: See the `DeepStream Dockerfile Guide `_ on GitHub for more details. --------------------------------------------------------------------------------- .. only:: Internal Usage of heavy TRT base dockers since DS 6.1.1 -------------------------------------------------------------------------------- Since Jetpack 5.0.2, NVIDIA Container Runtime no longer mounts user level libraries like CUDA, cuDNN and TensorRT from the host. These will instead be installed inside the containers. What does this mean for DS users? ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1) New DS Dockers thus take up double the space compared to previous Jetson dockers. 2) DS 6.3 dockers will run on Jetpack 5.1.2 only. 3) Older DS dockers are not compatible with Jetpack 5.1.2. | Recommended Minimal L4T Setup necessary to run the new docker images on Jetson -------------------------------------------------------------------------------- Users are encouraged to install the L4T BSP alone from Jetpack and later use command line to install NVIDIA Container runtime from Debian repo to save space on the Jetson device. 1. In Step 02 of `sdkmanager` Jetpack setup, select "Jetson OS" and de-select "Jetson SDK Components" to flash just the BSP. Refer to the screenshot below for reference. .. image:: ../content/DS_docker_containers_screenshot_BSP_only.png :align: center :alt: Gst-nvstreammux AV pipeline 2. Instructions for installing nvidia-container from command line: :: Flash BSP from Jetpack and boot Run "sudo apt update" Run "sudo apt install nvidia-container" Run "sudo service docker restart"