Docker Containers on AIR-T¶
Docker is a powerful platform for developing, shipping, and running applications in containers. One of the key benefits of using Docker is its ability to enhance application portability. Containers encapsulate an application and its dependencies, ensuring consistency across different environments, from development to production. This tutorial will demonstrate how to set up and run a docker container on your AIR-T that has properly exposed the radio drivers to the container.
This tutorial assumes you are running Airstack version 2.X. If you are running AirStack 1.0 or earlier you can find the tutorial here.
Docker Setup¶
-
Create the AirStack Dockerfile - Below is an example file to use Python 3.10 on AirStack 2.X, but feel free to add your own package requirements. Things to note:
-
Your container must install the packages soadysdr-tools and uhd-host to be able to control the radio.
-
The provided Dockerfile is a minimal solution if you just want to run the radio without any other GPU-accelerated frameworks installed. If you want to use CUDA or other JetPack libraries, a similar Dockerfile with the base image of
nvcr.io/nvidia/l4t-jetpack:r36.3.0
is recommended.
ARG BASE_IMAGE=nvcr.io/nvidia/l4t-base:r36.2.0 FROM --platform=linux/arm64 ${BASE_IMAGE} # Don't allow apt-get to prompt user when building a container ARG DEBIAN_FRONTEND=noninteractive # Basic setup to start installing packages: RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates gnupg2 curl git-core \ && rm -rf /var/lib/apt/lists/* && apt-get clean # Required for Airstack Install RUN apt-get update && apt-get install -y --no-install-recommends \ python3-all-dev \ soapysdr-tools \ uhd-host # Install Python 3.10 [Optional] RUN apt-get update && apt-get install -y --no-install-recommends \ python3.10 \ python3.10-venv # Required environment variables for CUDA ENV CUDA_HOME="/usr/local/cuda" ENV PATH="/usr/local/cuda/bin:${PATH}" ENV LD_LIBRARY_PATH="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}"
-
-
Build the Docker Container using the typical commands:
where thedocker build -t air_docker .
-t air_docker
is the tag associated with the new container. -
Run the Container :
Note: The container must be run with the "privileged" flag to be able to control the radio:
docker run -it --privileged air_docker:latest
Extra Information¶
User Permissions¶
If your user is not part of the Docker group on your system you can add it by running the command below and then logging out / back in. sudo usermod -aG docker <their user name>
. Running docker as sudo is not an advised solution by Deepwave.
Check Linux for Tegra Version¶
When setting up your Dockerfile you will need to ensure the base container Linux for Tegra version matches your Airstack version.
-
Determine what Linux for Tegra (L4T) version is running on your AIR-T by running the following command
$ cat /etc/nv_tegra_release
which will return something similar to the following (AirStack 2.1.0):The L4T version is found by combining the release with the REVISION: 36.3.0.# R36 (release), REVISION: 3.0, GCID: 36191598, BOARD: generic, EABI: aarch64, DATE: Mon May 6 17:34:21 UTC 2024
-
Search the NVIDIA L4T Base Catalog for your version and copy the url. If there is not an exact match in the L4T version, select the one that is closest but does not exceed your version. For example, AirStack 2.1.0 has L4T 36.3.0. Looking at the above link reveals that the closest but not newer than our AirStack version is choose 36.2.0.
Set Runtime to Nvidia¶
When running a container you will want to use the nvidia runtime. This should be set as a default in the docker config file found at: /etc/docker/daemon.json
. Below is an example run command to set the runtime each time you start the container:
docker run --runtime=nvidia -it air_docker:latest