Running opencv & TensorRT in Docker on a Jetson Nano/TX2

Hi together!

I have an application which works fine ‘bare-metal’ on the Nano, but when I want to containerize it via Docker some dependencies (opencv & tensorrt) are not available.

My starting point is the l4t base image which I want to use to bring all thing I need up.

I read about the nvidia-docker plugins (https://github.com/NVIDIA/libnvidia-container/blob/jetson/design/mount_plugins.md) which will get mounted when the corresponding .csv file is at /etc/nvidia-container-runtime/host-files-for-container.d, but I’m struggling to get all the dependencies running for opencv.

Furthermore I can see a tensorrt.csv file there, but TRT doesn’t work for either Python2.7 nor 3.6.

Nevertheless CUDA is available and when I try the .deviceQuery sample that seems to work fine
So my question basically is here how to get OpenCV running there and maybe a more detailed instruction how those .csv files should look like.

Any help is appreciated :-)

Hi,

In general, we mount libraries from host to save image size.
That’s why you cannot find the libraries inside the image directly.

Here are some container built for deepstream learning usage for your reference:
https://ngc.nvidia.com/catalog/containers?orderBy=modifiedDESC&pageNumber=0&query=l4t&quickFilter=containers&filters=

Thanks.

I am a beginner on containers. Aren’t we losing the whole charm of containers if we still have to mount libraries from the host? I know this saves image size, but then what will happen if I want to run the same container on another host (2) that does not have the libraries that exist on host(1)? Is this a reasonable question or am I missing some fundamentals?

2 Likes

Hi uersoy,

Please open a new topic for your issue. Thanks

I agree completely with your comments. Linking to host’s libraries seem to be a quick way to make it work (for nvidia), but it should be done the right way in the future. Did you have any luck with using tensorrt from inside a container? I’m still struggling with it.

Thanks.
Regards.

Hi drakorg,

yes it worked for me, but for Jetpack <= 4.3 I had to add the TensorRT Python library
(dir, /usr/lib/python3.6/dist-packages/tensorrt for Python3) to
/etc/nvidia-container-runtime/host-files-for-container.d/tensorrt.csv

In Jetpack 4.4 both - Python2 and Python3 bindings were already there.

Kind regards!

Yes, you are right, I remember not seeing the python binding in that csv in 4.3. Nonetheless, it hasn’t occurred to me to add it manually, probably because the whole csv part did not appear to be working already. I’m about ro reflash a 4.3 and will give it a try to 4.4 DP mabe later too. Good to hear you got it working, thank you.

Regards.
Eduardo