GPU Access Issue: CUDA Only Runs via Sudo inside Docker Dev Container (Orin NX / JP 6.1)

Hardware: Jetson Orin NX 16GB

JetPack Version: r36.4.0 (L4T)

Base Image: nvcr.io/nvidia/l4t-jetpack:r36.4.0

Hi everyone,

I’m setting up a development environment on a Jetson Orin NX using VS Code Dev Containers and hitting a persistent permissions wall regarding GPU access for a non-root user.

The Problem:

I have a simple compiled CUDA test script. Inside the container:

  • Running as a standard user (./cuda_test): The script fails to initialize (likely permissions/driver access).
  • Running with sudo (sudo ./cuda_test): The script runs perfectly and detects the Orin NX GPU.

The Setup & What I’ve Tried:

  1. Runtime Config: I have confirmed that --runtime nvidia is active. My devcontainer.json includes:
"runArgs": [
    "--runtime=nvidia",
    "--gpus=all"
]
  1. Device Node Permissions: I checked /dev/nvidia* nodes. I have already used chown to change ownership of these nodes to my container user, so they are not restricted to root on a file-system level.
  2. Group Memberships: My container user has been added to the root, video, and render groups:

Despite the device nodes being owned by the user and the user being in the correct groups, the CUDA driver seems to require root privileges to initialize the context.

I am using this with ROS2.
Thanks for any help/suggestion.