DEV Community

caelinsutch
caelinsutch

Posted on

Running Docker Containers for the NVIDIA Jetson Nano

The NVIDIA Jetson Nano, a low cost computer aimed at Machine Learning and AI tasks, can be effectivley used with Docker to increase development speed. Lets go through how you can setup docker to develop applications for the Jetson Nano on your x86 machine by emulating the Jetson Nano's ARM architecture and L4T OS.

Install Docker

To run docker containers, you'll have to install the docker engine. Follow the instructions here to install docker for your OS.

Configure Docker for aarch64

sudo apt-get install qemu binfmt-support qemu-user-static # Install the qemu packages  

docker run --rm --privileged multiarch/qemu-user-static --reset -p yes # This step will execute the registering scripts  

docker run --rm -t arm64v8/ubuntu uname -m # Testing the emulation environment  
aarch64 # Outputs the correct architecture

Configure Docker for NVIDIA

distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list

sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
sudo apt install -y nvidia-docker2
sudo systemctl daemon-reload
sudo systemctl restart docker

Pull NVIDIA Docker Containers

Run docker pull nvcr.io/nvidia/l4t-base:r32.4.2 to get the docker container.

To run the container:

  1. Allow external applications to connect to the host’s X display:

    xhost +
    
  2. Run the docker container using the docker command

    sudo docker run -it --rm --net=host --runtime nvidia  -e DISPLAY=$DISPLAY -w /opt/nvidia/deepstream/deepstream-5.0 -v /tmp/.X11-unix/:/tmp/.X11-unix nvcr.io/nvidia/deepstream-l4t:5.0-dp-20.04-samples
    

Arguments

  • -it: opens interactive terminal
  • --runtime nvidia: uses the GPU
  • --rm removes the container once you close the terminal.

An interactive terminal will pop up with the docker container running!

Top comments (0)