# GPU access inside Docker in Jetson Xavier

**URL:** <https://forums.developer.nvidia.com/t/gpu-access-inside-docker-in-jetson-xavier/205089>\
**Category:** Jetson Xavier NX\
**Tags:** docker, cuda\
**Created:** [March 4, 2022, 12:51pm UTC](https://forums.developer.nvidia.com/t/gpu-access-inside-docker-in-jetson-xavier/205089 "2022-03-04T12:51:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![naveen.crasta](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/naveen.crasta/32/122562_2.png) [@naveen.crasta](https://forums.developer.nvidia.com/u/naveen.crasta)\
**Post date:** [March 4, 2022, 12:51pm UTC](https://forums.developer.nvidia.com/t/gpu-access-inside-docker-in-jetson-xavier/205089/1 "2022-03-04T12:51:22Z")

</div>

Hi,  
Since I have some specific requirements, I am building my own Docker image for OpenCV 4.x and PyTorch on Jetson Xavier. I have tried two base images [nvcr.io/nvidia/l4t-base:r32.4.3](http://nvcr.io/nvidia/l4t-base:r32.4.3) and [nvcr.io/nvidia/l4t-cuda:10.2.460-runtime](http://nvcr.io/nvidia/l4t-cuda:10.2.460-runtime). When I tried to compile OpenCV with CUDA flag ON, it succeeds in the former but fails in the later. Also, torch.cuda.is\_available() throws False. So my question is i) which is the correct base image to start and ii) How do I access gpu inside the docker container? Are there any git repo to try?

Thanks.  
Naveen

---

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [March 7, 2022, 3:30am UTC](https://forums.developer.nvidia.com/t/gpu-access-inside-docker-in-jetson-xavier/205089/3 "2022-03-07T03:30:10Z")

</div>

Hi,

The difference is that _l4t-base_ mounts CUDA library from the Jetson native.  
But _l4t-cuda_ has the CUDA library installed in the container.

Please noted that currently we only provide _runtime_ version CUDA container (_l4t-cuda:10.2.460-runtime_).  
This indicates the image only has the essential library for running an executable.  
So you may fail to build CUDA binary due to some missing header.

For _l4t-base_, please find the link below for the information to access _nvcc_ at building time:

> **[GitHub - dusty-nv/jetson-containers: Machine Learning Containers for NVIDIA Jetson and...](https://github.com/dusty-nv/jetson-containers#docker-default-runtime)**
>
> Machine Learning Containers for NVIDIA Jetson and JetPack-L4T

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [March 30, 2022, 3:24am UTC](https://forums.developer.nvidia.com/t/gpu-access-inside-docker-in-jetson-xavier/205089/5 "2022-03-30T03:24:00Z")

</div>

Closed on March 30, 2022, 3:24am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
