C++ build tensorrt inside docker

Hello to all!
I am trying to create a multi-stage build with docker and balena for a jetson nx xavier. In the first stage (build-stage) I install all relevant packages and then copy and compile the c++ source files.
In the second stage (inference-stage) I would like to copy the relevant libraries and executable to reduce the size of the image.
This has worked well for other projects but I have problems with Tensorrt inside Docker.
Now to my question:
Is it possible to build tensorrt applications inside the docker file and are there corresponding base images? As I can see from Installation Guide :: NVIDIA Deep Learning TensorRT Documentation I need libnvinfer-dev libnvonnxparsers-dev libnvparsers-dev libnvinfer-plugin-dev to build c++ programs, but I can’t install them individually (neither in the dockerfile nor in the interactive console).
Is there a workaround or solution for this?
Thank you in advance!

Hi,

The Jetson-based package can be found in the JetPack.
If you have setup the device with SDKmanager, they should be located at ${HOME}/Downloads/nvidia/sdkm_downloads.

We also have some images that includes TensorRT as the prebuilt package.
For example, nvcr.io/nvidia/deepstream-l4t:5.1-21.02-base:

Thanks.

If you set your docker default runtime to ‘nvidia’, then you will be able to use CUDA/cuDNN/TensorRT/ect while building dockerfiles. See here - https://github.com/dusty-nv/jetson-containers#docker-default-runtime

You shouldn’t have to install the CUDA/cuDNN/TensorRT packages into the container itself, because these are mapped into the container from the device. The container you are using should ultimately be derived from l4t-base (or another container which uses l4t-base container)

Thank you for the response. Unfortunately, this solution doesn"t work for me, since we are building on top of the balena.io stack which does not support the runtime flag.

Thank you for your help. Can I also find these packages on the jetson if it is setup with the sd-card image provided on Jetson Download Center | NVIDIA Developer, or is it only possible by using the sdkmanager?

Hi,

The package need to be downloaded by SDKmanager.

Thanks.