Docker image for Jetson AGX Orin with CUDA environment

Hi Experts,

I want to build a docker image with CUDA environment on the Jetson AGX Orin.
After I build the image with the dockerfile I wrote below, I keep encounter the issue:

Cuda failed with error code no CUDA-capable device is detected

Any solution for this?
Thanks a lot!

OS: Ubuntu 20.04

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Wed_Nov_22_11:03:34_PST_2023
Cuda compilation tools, release 12.3, V12.3.107
Build cuda_12.3.r12.3/compiler.33567101_0

Software part of jetson-stats 4.2.8 - (c) 2024, Raffaello Bonghi
Model: Jetson AGX Orin - Jetpack 5.1 [L4T 35.2.1]
NV Power Mode[2]: MODE_30W
Serial Number: [XXX Show with: jetson_release -s XXX]
Hardware:

  • 699-level Part Number: 699-13701-0005-500 R.0
  • P-Number: p3701-0005
  • Module: NVIDIA Jetson AGX Orin (64GB ram)
  • SoC: tegra23x
  • CUDA Arch BIN: 8.7
  • Codename: Concord
    Platform:
  • Machine: aarch64
  • System: Linux
  • Distribution: Ubuntu 20.04 focal
  • Release: 5.10.104-tegra
  • Python: 3.8.10
    jtop:
  • Version: 4.2.8
  • Service: Active
    Libraries:
  • CUDA: 12.3.107
  • cuDNN: Not installed
  • TensorRT: Not installed
  • VPI: Not installed
  • OpenCV: 4.5.4 - with CUDA: NO
FROM nvcr.io/nvidia/l4t-jetpack:r36.3.0

# Install necessary dependencies including gcc
RUN apt-get update \
    && apt-get install -y wget build-essential git cmake libzmq3-dev pkg-config curl vim python3 python3-pip docker-compose ninja-build \
    && rm -rf /var/lib/apt/lists/*

RUN DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} \
    && mkdir -p $DOCKER_CONFIG/cli-plugins \
    && curl -SL https://github.com/docker/compose/releases/download/v2.26.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose \
    && chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
    
WORKDIR /

# Install GCC 12 and G++ 12
RUN apt-get update \
    && apt-get install -y software-properties-common \
    && add-apt-repository ppa:ubuntu-toolchain-r/test \
    && apt-get update \
    && apt-get install -y gcc-12 g++-12 \
    && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 \
    && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100

##### Install necessary packages
COPY ./requirements.txt /
RUN pip3 install -r requirements.txt && rm -rf requirements.txt

# Install Google Test
RUN git clone https://github.com/google/googletest.git \
  && cd googletest \
  && mkdir build \
  && cd build \
  && cmake .. \
  && make -j12 \
  && make -j12 install \
  && cd ../.. \
  && rm -rf googletest

RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/sbsa/cuda-keyring_1.1-1_all.deb \
  && dpkg -i cuda-keyring_1.1-1_all.deb \
  && apt-get update \
  && apt-get -y install cuda-toolkit-12-3 \
  && apt-get install -y nvidia-kernel-open-545 \
  && apt-get install -y cuda-drivers-545

Hi,

The l4t-jetpack is a container that includes iGPU driver and CUDA library.
So you don’t need to install it manually.

Moreover, the sbsa deb and cuda-drivers-545 are not compatible with Jetson.
Please remove them and try it again.

Thanks.


I use the CUDA Toolkit 12.2 in the container but still can not build the image.

Please take a look.

FROM nvcr.io/nvidia/l4t-jetpack:r36.3.0

# Install necessary dependencies including gcc
RUN apt-get update \
    && apt-get install -y wget build-essential git cmake libzmq3-dev pkg-config curl vim python3 python3-pip docker-compose ninja-build \
    && rm -rf /var/lib/apt/lists/*

RUN DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} \
    && mkdir -p $DOCKER_CONFIG/cli-plugins \
    && curl -SL https://github.com/docker/compose/releases/download/v2.26.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose \
    && chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
    
WORKDIR /

RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/arm64/cuda-ubuntu2004.pin \
  && mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 \
  && wget https://developer.download.nvidia.com/compute/cuda/12.2.0/local_installers/cuda-tegra-repo-ubuntu2004-12-2-local_12.2.0-1_arm64.deb \
  && dpkg -i cuda-tegra-repo-ubuntu2004-12-2-local_12.2.0-1_arm64.deb \
  && cp /var/cuda-tegra-repo-ubuntu2004-12-2-local/cuda-*-keyring.gpg /usr/share/keyrings/ \
  && apt-get update \
  && apt-get -y install cuda

Hi @AastaLLL,

I notice that maybe I dont need to install CUDA toolkit manually since I’ve use the l4t-jetpack:r36.3.0 image.

But after I build the image successfully, seems that there’s still something wrong with the CUDA driver.

Do I need to upgrade the OS from 20.04 to 22.04 for installing the CUDA toolkit 12.5?

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Tue_Aug_15_22:08:11_PDT_2023
Cuda compilation tools, release 12.2, V12.2.140
Build cuda_12.2.r12.2/compiler.33191640_0

FROM nvcr.io/nvidia/l4t-jetpack:r36.3.0

# Install necessary dependencies including gcc
RUN apt-get update \
    && apt-get install -y wget build-essential git cmake libzmq3-dev pkg-config curl vim python3 python3-pip docker-compose ninja-build \
    && rm -rf /var/lib/apt/lists/*

RUN DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker} \
    && mkdir -p $DOCKER_CONFIG/cli-plugins \
    && curl -SL https://github.com/docker/compose/releases/download/v2.26.1/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose \
    && chmod +x $DOCKER_CONFIG/cli-plugins/docker-compose
    
WORKDIR /

# Install GCC 12 and G++ 12
RUN apt-get update \
    && apt-get install -y software-properties-common \
    && add-apt-repository ppa:ubuntu-toolchain-r/test \
    && apt-get update \
    && apt-get install -y gcc-12 g++-12 \
    && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 100 \
    && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 100

##### Install necessary packages
COPY ./requirements.txt /
RUN pip3 install -r requirements.txt && rm -rf requirements.txt

# Install Google Test
RUN git clone https://github.com/google/googletest.git \
  && cd googletest \
  && mkdir build \
  && cd build \
  && cmake .. \
  && make -j12 \
  && make -j12 install \
  && cd ../.. \
  && rm -rf googletest

Hi,

Suppose this issue is fixed.
Do you need any help on the docker building?

Let’s track the CUDA test issue on the specified topic separately:

Thanks.

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