├── scripts ├── dummy_root_SSH_config ├── setup_launchscripts.sh └── jetson_docker_scripts ├── .gitattributes ├── assets ├── OpenCV-4.5.0-aarch64-ubuntu20.zip ├── torch-1.11.0-aarch64-ubuntu20.zip └── tensorrt-8.2.1.8-cp38-none-linux_aarch64.whl ├── Dockerfile.crosscompile ├── Dockerfile.opencv ├── Dockerfile.zedsdk ├── Dockerfile.pytorch ├── Dockerfile.ros2-base ├── Dockerfile.ros2-desktop ├── Dockerfile.tensorrt_source ├── Dockerfile.pytorch_source ├── Dockerfile.base ├── Dockerfile.opencv_source └── README.md /scripts/dummy_root_SSH_config: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | assets/* filter=lfs diff=lfs merge=lfs -text 2 | *.whl filter=lfs diff=lfs merge=lfs -text 3 | *.zip filter=lfs diff=lfs merge=lfs -text 4 | -------------------------------------------------------------------------------- /assets/OpenCV-4.5.0-aarch64-ubuntu20.zip: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:bd91fe3147f4bc0ed87bc66972a01f32ce5cfa91836defc6a3da507a26267048 3 | size 63346354 4 | -------------------------------------------------------------------------------- /assets/torch-1.11.0-aarch64-ubuntu20.zip: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:36475a2bc0eb4e1905a6104b63e599ae690f7ed9644334c47750aac4eabf86b4 3 | size 254200613 4 | -------------------------------------------------------------------------------- /assets/tensorrt-8.2.1.8-cp38-none-linux_aarch64.whl: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:abec850a72f9cd0283df9cafba5d26bcb223f80fd7b32c683a92bbb8ee331d35 3 | size 816271 4 | -------------------------------------------------------------------------------- /Dockerfile.crosscompile: -------------------------------------------------------------------------------- 1 | FROM timongentzsch/l4t-ubuntu20-base 2 | 3 | ARG DEBIAN_FRONTEND=noninteractive 4 | 5 | # 6 | # Build tools 7 | # 8 | RUN apt-get update && \ 9 | apt-get install -y --no-install-recommends cmake build-essential python3-dev python3-pip cuda-toolkit-10-2 && \ 10 | rm -rf /var/lib/apt/lists/* && \ 11 | apt-get clean 12 | 13 | # Required for cuda compiler 14 | RUN apt-get update && \ 15 | apt-get install -y --no-install-recommends gcc-8 g++-8 && \ 16 | update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 8 && \ 17 | update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 8 18 | 19 | WORKDIR /root 20 | CMD ["bash"] 21 | -------------------------------------------------------------------------------- /Dockerfile.opencv: -------------------------------------------------------------------------------- 1 | FROM timongentzsch/l4t-ubuntu20-base 2 | 3 | ARG DEBIAN_FRONTEND=noninteractive 4 | ARG OPEN_CV_VERSION=4.5.0 5 | 6 | # 7 | # overwrite with cuda opencv 8 | # 9 | 10 | RUN apt-get update && apt-get install -y --no-install-recommends python3-pip python3-dev unzip && \ 11 | rm -rf /var/lib/apt/lists/* && \ 12 | apt-get clean 13 | 14 | WORKDIR /tmp 15 | RUN --mount=target=/assets,type=bind,source=assets \ 16 | cp /assets/OpenCV-${OPEN_CV_VERSION}-aarch64-ubuntu20.zip . && \ 17 | unzip OpenCV-${OPEN_CV_VERSION}-aarch64-ubuntu20.zip && \ 18 | apt update && \ 19 | apt install -y --no-install-recommends -f ./*.deb && \ 20 | rm -rf /var/lib/apt/lists/* && \ 21 | rm -rf * \ 22 | apt-get clean 23 | 24 | #install missing numpy 25 | RUN pip3 install numpy 26 | 27 | WORKDIR /root 28 | CMD ["bash"] 29 | -------------------------------------------------------------------------------- /scripts/setup_launchscripts.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | SCRIPT_PATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" 3 | SCRIPT_PATH=$( echo "$SCRIPT_PATH" | sed 's/ /\\ /g') 4 | 5 | sudo chown root ${SCRIPT_PATH}/dummy_root_SSH_config 6 | sudo chmod 600 ${SCRIPT_PATH}/dummy_root_SSH_config 7 | 8 | if grep -qxF "# Source jetson docker scripts" "$HOME/.bashrc" ; then 9 | echo "Already sourcing jetson_docker_scripts" 10 | echo "Deleting..." 11 | # get line number 12 | LINE_NUMBER=$(grep -n "# Source jetson docker scripts" "$HOME/.bashrc" | cut -d: -f1) 13 | # remove line and line below 14 | sed -i "${LINE_NUMBER}d" "$HOME/.bashrc" 15 | sed -i "${LINE_NUMBER}d" "$HOME/.bashrc" 16 | fi 17 | 18 | echo "# Source jetson docker scripts" >> $HOME/.bashrc 19 | echo "source $SCRIPT_PATH/jetson_docker_scripts && export DUMMY_SSH_CONFIG="${SCRIPT_PATH}/dummy_root_SSH_config"" >> $HOME/.bashrc 20 | echo "jetson_docker_scripts.bash added to .bashrc" -------------------------------------------------------------------------------- /Dockerfile.zedsdk: -------------------------------------------------------------------------------- 1 | FROM timongentzsch/l4t-ubuntu20-opencv 2 | 3 | ENV LOGNAME root 4 | ARG DEBIAN_FRONTEND=noninteractive 5 | 6 | ARG L4T_MINOR_VERSION=1 7 | ARG ZED_SDK_MAJOR=3 8 | ARG ZED_SDK_MINOR=7 9 | ARG JETPACK_MAJOR=32 10 | ARG JETPACK_MINOR=7 11 | 12 | # 13 | # install zedsdk 14 | # 15 | 16 | RUN apt-get update -y && apt-get install --no-install-recommends -y lsb-release wget less udev sudo apt-transport-https build-essential cmake libusb-1.0-0-dev && \ 17 | echo "# R${JETPACK_MAJOR} (release), REVISION: ${JETPACK_MINOR}.${L4T_MINOR_VERSION}" > /etc/nv_tegra_release ; \ 18 | wget -q --no-check-certificate -O ZED_SDK_Linux_JP.run https://download.stereolabs.com/zedsdk/${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}/l4t${JETPACK_MAJOR}.${JETPACK_MINOR}/jetsons && \ 19 | chmod +x ZED_SDK_Linux_JP.run && ./ZED_SDK_Linux_JP.run silent && \ 20 | rm -rf /usr/local/zed/resources/* && \ 21 | rm -rf ZED_SDK_Linux_JP.run && \ 22 | rm -rf /var/lib/apt/lists/* 23 | 24 | # 25 | # setup zed sdk for recording 26 | # 27 | RUN ln -sf /usr/lib/aarch64-linux-gnu/tegra/libv4l2.so.0 /usr/lib/aarch64-linux-gnu/libv4l2.so 28 | 29 | CMD ["bash"] 30 | WORKDIR /root 31 | -------------------------------------------------------------------------------- /Dockerfile.pytorch: -------------------------------------------------------------------------------- 1 | FROM timongentzsch/l4t-ubuntu20-opencv 2 | 3 | ARG DEBIAN_FRONTEND=noninteractive 4 | ARG BUILD_SOX=1 5 | ARG PYTORCH_VERSION=1.11.0 6 | 7 | # 8 | # install pytorch deps 9 | # 10 | RUN apt-get update && apt-get install -y --no-install-recommends python3-pip python3-dev libopenblas-dev libjpeg-dev zlib1g-dev sox libsox-dev libsox-fmt-all unzip && \ 11 | rm -rf /var/lib/apt/lists/* && \ 12 | apt-get clean 13 | 14 | SHELL ["/bin/bash", "-c", "-l"] 15 | 16 | # 17 | # install prebuild pytorch binaries 18 | # 19 | WORKDIR /tmp/ 20 | RUN --mount=target=/assets,type=bind,source=assets \ 21 | cp /assets/torch-${PYTORCH_VERSION}-aarch64-ubuntu20.zip . && \ 22 | unzip torch-${PYTORCH_VERSION}-aarch64-ubuntu20.zip && \ 23 | pip3 install *.whl && \ 24 | rm -rf * 25 | 26 | # 27 | # install tensorrt python bindings 28 | # 29 | RUN --mount=target=/assets,type=bind,source=assets \ 30 | cp /assets/tensorrt-8.2.1.8-cp38-none-linux_aarch64.whl . && \ 31 | pip3 install *.whl && \ 32 | rm -rf * 33 | 34 | ENV PATH=/usr/local/cuda/bin:/usr/local/cuda-10.2/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 35 | ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/cuda-10.2/targets/aarch64-linux/lib: 36 | 37 | CMD ["bash"] 38 | WORKDIR /root 39 | -------------------------------------------------------------------------------- /Dockerfile.ros2-base: -------------------------------------------------------------------------------- 1 | FROM timongentzsch/l4t-ubuntu20-opencv 2 | 3 | ARG DEBIAN_FRONTEND=noninteractive 4 | 5 | ARG ROS_PKG=ros_base 6 | ARG ROS_DISTRO=foxy 7 | ARG ROS_ROOT=/opt/ros/${ROS_DISTRO} 8 | 9 | # 10 | # change the locale from POSIX to UTF-8 11 | # 12 | RUN apt-get update && \ 13 | apt-get install -y --no-install-recommends \ 14 | locales \ 15 | && rm -rf /var/lib/apt/lists/* \ 16 | && apt-get clean 17 | RUN locale-gen en_US en_US.UTF-8 && update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 18 | ENV LANG=en_US.UTF-8 19 | ENV PYTHONIOENCODING=utf-8 20 | 21 | # 22 | # add the ROS deb repo to the apt sources list 23 | # 24 | RUN apt-get update && \ 25 | apt-get install -y --no-install-recommends \ 26 | curl \ 27 | wget \ 28 | gnupg2 \ 29 | lsb-release \ 30 | ca-certificates \ 31 | && rm -rf /var/lib/apt/lists/* \ 32 | && apt-get clean 33 | 34 | RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg 35 | RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null 36 | 37 | # 38 | # install ros2 packages 39 | # 40 | RUN apt-get update && \ 41 | apt-get install -y --no-install-recommends \ 42 | ros-${ROS_DISTRO}-ros-base \ 43 | python3-colcon-common-extensions \ 44 | && rm -rf /var/lib/apt/lists/* \ 45 | && apt-get clean 46 | 47 | # source ROS 48 | RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /root/.bashrc 49 | 50 | CMD ["bash"] 51 | WORKDIR /root 52 | -------------------------------------------------------------------------------- /Dockerfile.ros2-desktop: -------------------------------------------------------------------------------- 1 | FROM timongentzsch/l4t-ubuntu20-opencv 2 | 3 | ARG DEBIAN_FRONTEND=noninteractive 4 | 5 | ARG ROS_PKG=ros_base 6 | ARG ROS_DISTRO=foxy 7 | ARG ROS_ROOT=/opt/ros/${ROS_DISTRO} 8 | 9 | # 10 | # change the locale from POSIX to UTF-8 11 | # 12 | RUN apt-get update && \ 13 | apt-get install -y --no-install-recommends \ 14 | locales \ 15 | && rm -rf /var/lib/apt/lists/* \ 16 | && apt-get clean 17 | RUN locale-gen en_US en_US.UTF-8 && update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 18 | ENV LANG=en_US.UTF-8 19 | ENV PYTHONIOENCODING=utf-8 20 | 21 | # 22 | # add the ROS deb repo to the apt sources list 23 | # 24 | RUN apt-get update && \ 25 | apt-get install -y --no-install-recommends \ 26 | curl \ 27 | wget \ 28 | gnupg2 \ 29 | lsb-release \ 30 | ca-certificates \ 31 | && rm -rf /var/lib/apt/lists/* \ 32 | && apt-get clean 33 | 34 | RUN curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg 35 | RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/ros2.list > /dev/null 36 | 37 | # 38 | # install ros2 packages 39 | # 40 | RUN apt-get update && \ 41 | apt-get install -y --no-install-recommends \ 42 | ros-${ROS_DISTRO}-desktop \ 43 | python3-colcon-common-extensions \ 44 | && rm -rf /var/lib/apt/lists/* \ 45 | && apt-get clean 46 | 47 | # source ROS 48 | RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" >> /root/.bashrc 49 | 50 | CMD ["bash"] 51 | WORKDIR /root 52 | -------------------------------------------------------------------------------- /Dockerfile.tensorrt_source: -------------------------------------------------------------------------------- 1 | FROM timongentzsch/l4t-ubuntu20-opencv-source 2 | 3 | ENV DEBIAN_FRONTEND=noninteractive 4 | ENV TENSORRT_VERSION=8.2.1 5 | ENV TARGET_ARCHITECTURE=aarch64 6 | ENV PYTHON_MAJOR_VERSION=3 7 | ENV PYTHON_MINOR_VERSION=8 8 | 9 | ENV CUDA_ROOT=/usr/local/cuda-10.2 10 | ENV ROOT_PATH=/workspace/TensorRT 11 | ENV EXT_PATH=/tmp 12 | 13 | ENV PYTHON_SOURCE_TARBALL_VERSION=3.8.10 14 | ENV PYTHON_SOURCE_TARBALL_URL=https://www.python.org/ftp/python/3.8.10/Python-3.8.10.tgz 15 | 16 | ENV PYBIND_RELEASE=v2.7.0 17 | 18 | ### TODO: Add multistagebuild with crosscompile image ### 19 | 20 | RUN apt-get update && apt-get install -y --no-install-recommends python3-pip python3-dev cmake build-essential git && \ 21 | rm -rf /var/lib/apt/lists/* && \ 22 | apt-get clean 23 | 24 | # 25 | # preparation 26 | # 27 | WORKDIR $EXT_PATH 28 | RUN git clone https://github.com/pybind/pybind11.git -b ${PYBIND_RELEASE} && \ 29 | mkdir -p python${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION}/include && \ 30 | wget ${PYTHON_SOURCE_TARBALL_URL} && \ 31 | tar -xzf *.tgz && \ 32 | rm -rf *.tgz && \ 33 | mv Python-${PYTHON_SOURCE_TARBALL_VERSION}/Include/* python${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION}/include && \ 34 | rm -rf Python-${PYTHON_SOURCE_TARBALL_VERSION} && \ 35 | cp /usr/include/aarch64-linux-gnu/python3.8/pyconfig.h python${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION}/include 36 | 37 | SHELL ["/bin/bash", "-c", "-l"] 38 | # 39 | # TensortRT 40 | # 41 | WORKDIR /workspace 42 | RUN git clone --recursive https://github.com/NVIDIA/TensorRT.git -b $TENSORRT_VERSION 43 | 44 | RUN cd TensorRT/python && \ 45 | PYTHON_MAJOR_VERSION=$PYTHON_MAJOR_VERSION PYTHON_MINOR_VERSION=$PYTHON_MINOR_VERSION TARGET=$TARGET_ARCHITECTURE ./build.sh 46 | 47 | # 48 | # TEST 49 | # 50 | RUN python3 -m pip install ${ROOT_PATH}/python/build/dist/tensorrt-*.whl 51 | 52 | 53 | CMD ["bash"] 54 | WORKDIR /root 55 | -------------------------------------------------------------------------------- /Dockerfile.pytorch_source: -------------------------------------------------------------------------------- 1 | FROM timongentzsch/l4t-ubuntu20-opencv-source 2 | 3 | ENV DEBIAN_FRONTEND=noninteractive 4 | 5 | ENV TORCH_CUDA_ARCH_LIST=5.3;6.2;7.2 6 | ENV BUILD_SOX=1 7 | 8 | ENV USE_NCCL=0 9 | ENV USE_DISTRIBUTED=0 10 | ENV USE_QNNPACK=0 11 | ENV USE_PYTORCH_QNNPACK=0 12 | ENV PYTORCH_BUILD_VERSION=1.11.0 13 | ENV TORCHVISION_VERSION=v0.12.0 14 | ENV TORCHAUDIO_VERSION=v0.11.0 15 | 16 | ### TODO: Add multistagebuild with crosscompile image ### 17 | 18 | RUN apt-get update && apt-get install -y --no-install-recommends python3-pip python3-dev cmake libopenblas-dev git && \ 19 | rm -rf /var/lib/apt/lists/* && \ 20 | apt-get clean 21 | 22 | RUN pip3 install scikit-build 23 | RUN pip3 install ninja 24 | 25 | # 26 | # pytorch 27 | # 28 | RUN git clone --recursive https://github.com/pytorch/pytorch -b v$PYTORCH_BUILD_VERSION && \ 29 | cd pytorch && \ 30 | pip3 install -r requirements.txt 31 | 32 | RUN cd /root/pytorch/ && \ 33 | wget https://gist.githubusercontent.com/dusty-nv/ce51796085178e1f38e3c6a1663a93a1/raw/4f1a0f948150c91f877aa38075835df748c81fe5/pytorch-1.11-jetpack-5.0.patch && \ 34 | git apply *.patch 35 | 36 | ENV PYTORCH_BUILD_NUMBER=1 37 | RUN cd pytorch && \ 38 | python3 setup.py bdist_wheel && \ 39 | python3 setup.py install 40 | 41 | # 42 | # torchvision 43 | # 44 | RUN apt-get update && apt-get install -y --no-install-recommends libjpeg-dev zlib1g-dev && \ 45 | rm -rf /var/lib/apt/lists/* && \ 46 | apt-get clean 47 | 48 | RUN git clone -b ${TORCHVISION_VERSION} https://github.com/pytorch/vision torchvision && \ 49 | cd torchvision && \ 50 | python3 setup.py bdist_wheel 51 | RUN pip3 install --no-cache-dir pillow 52 | 53 | # 54 | # torchaudio 55 | # 56 | RUN apt-get update && apt-get install -y --no-install-recommends sox libsox-dev libsox-fmt-all && \ 57 | rm -rf /var/lib/apt/lists/* && \ 58 | apt-get clean 59 | 60 | RUN git clone --recursive https://github.com/pytorch/audio torchaudio && \ 61 | cd torchaudio && \ 62 | python3 setup.py bdist_wheel 63 | 64 | ENV PATH=/usr/local/cuda/bin:/usr/local/cuda-10.2/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin 65 | ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/cuda-10.2/targets/aarch64-linux/lib: 66 | 67 | CMD ["bash"] 68 | WORKDIR /root 69 | -------------------------------------------------------------------------------- /Dockerfile.base: -------------------------------------------------------------------------------- 1 | FROM ubuntu:focal 2 | 3 | ARG L4T_RELEASE_MAJOR=32.7 4 | ARG L4T_RELEASE_MINOR=1 5 | ARG CUDA=10.2 6 | ARG DEBIAN_FRONTEND=noninteractive 7 | ARG SOC="t194" 8 | 9 | ARG L4T_RELEASE=$L4T_RELEASE_MAJOR.$L4T_RELEASE_MINOR 10 | 11 | RUN apt-get update && \ 12 | apt-get install -y --no-install-recommends apt-utils software-properties-common && \ 13 | apt-get upgrade -y && \ 14 | rm -rf /var/lib/apt/lists/* && \ 15 | apt-get clean 16 | 17 | # 18 | # Jetson debian packages 19 | # 20 | RUN echo $L4T_RELEASE_MAJOR 21 | ADD --chown=root:root https://repo.download.nvidia.com/jetson/jetson-ota-public.asc /etc/apt/trusted.gpg.d/jetson-ota-public.asc 22 | RUN chmod 644 /etc/apt/trusted.gpg.d/jetson-ota-public.asc && \ 23 | apt-get update && apt-get install -y --no-install-recommends ca-certificates && \ 24 | echo "deb https://repo.download.nvidia.com/jetson/common r$L4T_RELEASE_MAJOR main" > /etc/apt/sources.list.d/nvidia-l4t-apt-source.list && \ 25 | echo "deb https://repo.download.nvidia.com/jetson/${SOC} r$L4T_RELEASE_MAJOR main" >> /etc/apt/sources.list.d/nvidia-l4t-apt-source.list && \ 26 | rm -rf /var/lib/apt/lists/* && \ 27 | apt-get clean 28 | 29 | # 30 | # Tegra setup 31 | # 32 | RUN apt-get update && \ 33 | apt-get install -y libglu1-mesa-dev freeglut3 freeglut3-dev unzip dialog && \ 34 | rm -rf /var/lib/apt/lists/* && \ 35 | apt-get clean 36 | 37 | RUN echo "/usr/lib/aarch64-linux-gnu/tegra" >> /etc/ld.so.conf.d/nvidia-tegra.conf && \ 38 | echo "/usr/lib/aarch64-linux-gnu/tegra-egl" >> /etc/ld.so.conf.d/nvidia-tegra.conf 39 | RUN rm /usr/share/glvnd/egl_vendor.d/50_mesa.json 40 | RUN mkdir -p /usr/share/glvnd/egl_vendor.d/ && \ 41 | echo '{"file_format_version" : "1.0.0" , "ICD" : { "library_path" : "libEGL_nvidia.so.0" }}' > /usr/share/glvnd/egl_vendor.d/10_nvidia.json 42 | RUN mkdir -p /usr/share/egl/egl_external_platform.d/ && \ 43 | echo '{"file_format_version" : "1.0.0" , "ICD" : { "library_path" : "libnvidia-egl-wayland.so.1" }}' > /usr/share/egl/egl_external_platform.d/nvidia_wayland.json 44 | RUN echo "/usr/local/cuda-$CUDA/targets/aarch64-linux/lib" >> /etc/ld.so.conf.d/nvidia.conf 45 | 46 | RUN ldconfig 47 | 48 | # 49 | # Update environment 50 | # 51 | ENV PATH /usr/local/cuda-$CUDA/bin:/usr/local/cuda/bin:${PATH} 52 | ENV LD_LIBRARY_PATH /usr/local/cuda-$CUDA/targets/aarch64-linux/lib:${LD_LIBRARY_PATH} 53 | ENV LD_LIBRARY_PATH=/opt/nvidia/vpi1/lib64:${LD_LIBRARY_PATH} 54 | ENV LD_LIBRARY_PATH=/usr/lib/aarch64-linux-gnu/tegra:${LD_LIBRARY_PATH} 55 | ENV LD_LIBRARY_PATH=/usr/lib/aarch64-linux-gnu/tegra-egl:${LD_LIBRARY_PATH} 56 | 57 | ENV NVIDIA_VISIBLE_DEVICES all 58 | ENV NVIDIA_DRIVER_CAPABILITIES all 59 | ENV OPENBLAS_CORETYPE=ARMV8 60 | 61 | WORKDIR /root 62 | CMD ["bash"] 63 | -------------------------------------------------------------------------------- /Dockerfile.opencv_source: -------------------------------------------------------------------------------- 1 | FROM timongentzsch/l4t-ubuntu20-base 2 | 3 | ARG DEBIAN_FRONTEND=noninteractive 4 | ARG OPEN_CV_VERSION=4.5.0 5 | 6 | ### TODO: Add multistagebuild with crosscompile image ### 7 | 8 | # 9 | # install opencv deps 10 | # 11 | RUN apt-get update && \ 12 | apt-get install -y --no-install-recommends build-essential cmake git unzip pkg-config \ 13 | libjpeg-dev libpng-dev libtiff-dev \ 14 | libavcodec-dev libavformat-dev libswscale-dev \ 15 | libgtk2.0-dev libcanberra-gtk* \ 16 | python3-dev python3-numpy python3-pip \ 17 | libxvidcore-dev libx264-dev libgtk-3-dev \ 18 | libtbb2 libtbb-dev libdc1394-22-dev \ 19 | gstreamer1.0-tools libv4l-dev v4l-utils \ 20 | libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \ 21 | libavresample-dev libvorbis-dev libxine2-dev \ 22 | libfaac-dev libmp3lame-dev libtheora-dev \ 23 | libopencore-amrnb-dev libopencore-amrwb-dev \ 24 | libopenblas-dev libatlas-base-dev libblas-dev \ 25 | liblapack-dev libeigen3-dev gfortran \ 26 | libhdf5-dev protobuf-compiler \ 27 | libprotobuf-dev libgoogle-glog-dev libgflags-dev qt5-default \ 28 | file && \ 29 | rm -rf /var/lib/apt/lists/* && \ 30 | apt-get clean 31 | 32 | # 33 | # required for cuda compiler 34 | # 35 | RUN apt-get update && \ 36 | apt-get install -y --no-install-recommends gcc-8 g++-8 && \ 37 | update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 8 && \ 38 | update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 8 && \ 39 | rm -rf /var/lib/apt/lists/* && \ 40 | apt-get clean 41 | 42 | RUN git clone --depth 1 https://github.com/opencv/opencv.git -b ${OPEN_CV_VERSION} && \ 43 | git clone --depth 1 https://github.com/opencv/opencv_contrib.git -b ${OPEN_CV_VERSION} 44 | 45 | # 46 | # build opencv debian pacakges from source. 47 | # the generated .deb files will be found in release/*.deb . 48 | # they will install opencv in /usr/local so it will not conflict with native ubuntu 49 | # opencv installed version and will receive precedence with ld when loading opencv libraries 50 | # 51 | RUN cd opencv && \ 52 | mkdir release && \ 53 | cd release && \ 54 | cmake -D CUDA_ARCH_BIN="7.2,5.3" \ 55 | -D WITH_CUDA=ON \ 56 | -D CUDA_ARCH_PTX="" \ 57 | -D OPENCV_GENERATE_PKGCONFIG=ON \ 58 | -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \ 59 | -D WITH_LIBV4L=ON \ 60 | -D BUILD_opencv_python3=ON \ 61 | -D BUILD_TESTS=OFF \ 62 | -D BUILD_PERF_TESTS=OFF \ 63 | -D BUILD_EXAMPLES=OFF \ 64 | -D CMAKE_BUILD_TYPE=RELEASE \ 65 | -D CPACK_BINARY_DEB=ON \ 66 | -D CPACK_SET_DESTDIR=OFF \ 67 | -D CPACK_PACKAGING_INSTALL_PREFIX=/usr/local .. 68 | 69 | RUN cd opencv/release && make -j$(nproc) 70 | RUN cd opencv/release && make install 71 | RUN cd opencv/release && make package 72 | 73 | CMD ["bash"] 74 | WORKDIR /root 75 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | --- 2 | **Deprecation notice** 3 | 4 | This repository will no longer be updated, since Nvidia started to provide its own Docker images based on Ubuntu 20 as of [JETPACK SDK 5.0.1](https://developer.nvidia.com/embedded/jetpack-sdk-501dp) ([Link to images](https://github.com/dusty-nv/jetson-containers)). 5 | 6 | Therefore, the Dockerfiles in this repository should only be used as reference if **CUDA 10.2** is a requirement. 7 | 8 | --- 9 | 10 | # Hardware accelerated Docker images based on Ubuntu 20.04 for Jetson family 11 | 12 | Nvidia Jetson images are based on Ubuntu 18.04. However, many applications and projects utilizes libraries specific to Ubuntu 20.04. Therefore, this repository provides docker images based on [`ubuntu:focal`](Dockerfile.ros2), that are able to take full advantage of the Jetson hardware (Nano, Xavier NX, Xavier AGX and Xavier TX2). All images come with full CUDA support (passthrough from the host) including TensorRT (including python bindings) and VisionWorks. 13 | 14 | 15 | 16 | Furthermore the [script](scripts) folder includes system installable run-scripts to quickly iterate the build process and set the relevant docker flags at runtime. 17 | 18 | 19 | 20 | The following images can be directly pulled from DockerHub without needing to build the containers yourself: 21 | 22 | 23 | 24 | 25 | | | L4T Version | Dockerhub image | 26 | |------------------------|:-----------:|----------------------------------------------------| 27 | | [`l4t-ubuntu20-base`](Dockerfile.base) | R32.7.1 | `timongentzsch/l4t-ubuntu20-base:latest` | 28 | | [`l4t-ubuntu20-opencv`](Dockerfile.opencv) | R32.7.1 | `timongentzsch/l4t-ubuntu20-opencv:latest` | 29 | | [`l4t-ubuntu20-pytorch`](Dockerfile.pytorch) | R32.7.1 | `timongentzsch/l4t-ubuntu20-pytorch:latest` | 30 | | [`l4t-ubuntu20-ros2-base`](Dockerfile.ros2-base) | R32.7.1 | `timongentzsch/l4t-ubuntu20-ros2-base:latest` | 31 | | [`l4t-ubuntu20-ros2-desktop`](Dockerfile.ros2-desktop) | R32.7.1 | `timongentzsch/l4t-ubuntu20-ros2-desktop:latest` | 32 | | [`l4t-ubuntu20-zedsdk`](Dockerfile.zedsdk) | R32.7.1 | `timongentzsch/l4t-ubuntu20-zedsdk:latest` | 33 | | [`l4t-ubuntu20-crosscompile`](Dockerfile.crosscompile) | R32.7.1 | `timongentzsch/l4t-ubuntu20-crosscompile:latest` | 34 | 35 | 36 | > **note:** make sure to run the container on the intended L4T host system. Running on older JetPack releases (e.g. r32.6.1) can cause driver issues, since L4T drivers are passed into the container. 37 | 38 | 39 | > **note:** pytorch image also inckudes the python3.8 tensorrt bindings 40 | 41 | 42 | 43 | To download and run one of these images, you can use the included run script from the repo: 44 | 45 | 46 | 47 | ``` bash 48 | 49 | $ scripts/docker_run timongentzsch/l4t-ubuntu20-base:latest 50 | 51 | ``` 52 | 53 | 54 | 55 | For other configurations, below are the instructions to build and test the containers using the included Dockerfiles. 56 | 57 | 58 | 59 | ## Docker Default Runtime 60 | 61 | 62 | 63 | To enable access to the CUDA compiler (nvcc) during `docker build` operations, add `"default-runtime": "nvidia"` to your `/etc/docker/daemon.json` configuration file before attempting to build the containers: 64 | 65 | 66 | 67 | ``` json 68 | 69 | { 70 | 71 | "runtimes": { 72 | 73 | "nvidia": { 74 | 75 | "path": "nvidia-container-runtime", 76 | 77 | "runtimeArgs": [] 78 | 79 | } 80 | 81 | }, 82 | 83 | "default-runtime": "nvidia" 84 | 85 | } 86 | 87 | ``` 88 | 89 | 90 | 91 | You will then want to restart the Docker service or reboot your system before proceeding. 92 | 93 | 94 | 95 | ## Build and test the images 96 | 97 | 98 | 99 | To rebuild the containers from a Jetson device, first clone this repo via [`Git LFS`](https://git-lfs.github.com/): 100 | 101 | 102 | 103 | ``` bash 104 | 105 | $ git clone https://github.com/timongentzsch/Jetson_Ubuntu20_Images.git 106 | 107 | $ cd Jetson_Ubuntu20_Images 108 | 109 | ``` 110 | 111 | 112 | 113 | ## Work with the provided scripts 114 | 115 | 116 | 117 | You may want to install the provided scripts to build, run and restart containers with the right set of docker flags: 118 | 119 | 120 | 121 | ``` bash 122 | 123 | $ sudo scripts/setup_launchscripts.sh 124 | 125 | ``` 126 | 127 | 128 | 129 | This will enable you to quickly iterate your build process and application. Sudo is needed to create the `dummy_root_SSH_config` and enable SSH access for root users 130 | 131 | 132 | 133 | After that you can use following commands globally: 134 | 135 | 136 | 137 | `dbuild`, `drun`, `dstart` 138 | 139 | 140 | 141 | It ensures that the docker environment feels as native as possible by enabling the following features by default: 142 | 143 | - USB hot plug 144 | 145 | - sound 146 | 147 | - network 148 | 149 | - bluetooth 150 | 151 | - GPU/cuda 152 | 153 | - X11 154 | 155 | 156 | 157 | > **note:** refer to `--help` for the syntax 158 | -------------------------------------------------------------------------------- /scripts/jetson_docker_scripts: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # load docker completion 4 | _completion_loader docker; 5 | 6 | function docker_alias_completion_wrapper { 7 | local completion_function="$1"; 8 | local alias_name="$2"; 9 | 10 | local func=$(cat </dev/null && $completion_function; 22 | 23 | eval "\$previous_extglob_setting"; 24 | return 0; 25 | }; 26 | EOT 27 | ); 28 | eval "$func"; 29 | 30 | # Register the alias completion function 31 | complete -F _$alias_name $alias_name 32 | } 33 | 34 | export -f docker_alias_completion_wrapper 35 | 36 | # Check if script is executed on Jetson platform 37 | CUDA_DIRECTORY="/usr/local/cuda-10.2" 38 | IS_JETSON=false 39 | 40 | if [[ -d "$CUDA_DIRECTORY" ]] && [ "aarch64" == $(uname -m) ]; then 41 | IS_JETSON=true 42 | fi 43 | 44 | ### 45 | ### Run Docker container 46 | ### 47 | 48 | drun() { 49 | IS_ROOT_USER=true 50 | 51 | # Allow X11 access 52 | xhost +si:localuser:root 53 | 54 | # Intial variable setup 55 | DOCKER_CUSTOM_ARGS=$@ 56 | DOCKER_DEFAULT_ARGS=() 57 | DOCKER_DEFAULT_ARGS+=("-it") 58 | DOCKER_USER_HOME="/root" 59 | 60 | # Default: Disposable Container 61 | PERSISTENT_CONTAINER=0 62 | 63 | while [[ $# -gt 0 ]]; do 64 | key="$1" 65 | 66 | case $key in 67 | -u|--user) 68 | IS_ROOT_USER=false 69 | DOCKER_USER_HOME="/home/$2" 70 | echo "Using User $2 with \$HOME=$DOCKER_USER_HOME" 71 | echo "" 72 | shift # past argument 73 | shift # past value 74 | ;; 75 | --name) 76 | PERSISTENT_CONTAINER=1 77 | CONTAINER_NAME="$2" 78 | shift # past argument 79 | shift # past value 80 | ;; 81 | *) # default 82 | shift # past argument 83 | echo $@ 84 | ;; 85 | esac 86 | done 87 | 88 | if [[ $PERSISTENT_CONTAINER -eq 0 ]];then 89 | DOCKER_DEFAULT_ARGS+=("--rm") 90 | echo "Using disposable container" 91 | echo "" 92 | else 93 | echo "Saving container under: $CONTAINER_NAME" 94 | echo "" 95 | fi 96 | 97 | # Map host's display socket to docker 98 | DOCKER_DEFAULT_ARGS+=("-v /tmp/.X11-unix:/tmp/.X11-unix") 99 | DOCKER_DEFAULT_ARGS+=("-e DISPLAY") 100 | 101 | # Device and audio passtrough 102 | DOCKER_DEFAULT_ARGS+=("--privileged") 103 | DOCKER_DEFAULT_ARGS+=("-e 'TERM=xterm-256color'") 104 | DOCKER_DEFAULT_ARGS+=("--network host") 105 | DOCKER_DEFAULT_ARGS+=("-v /dev:/dev") 106 | DOCKER_DEFAULT_ARGS+=("-v /mnt:/mnt") 107 | DOCKER_DEFAULT_ARGS+=("-v /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket") 108 | DOCKER_DEFAULT_ARGS+=("-e PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native") 109 | DOCKER_DEFAULT_ARGS+=("-v ${XDG_RUNTIME_DIR}/pulse/native:${XDG_RUNTIME_DIR}/pulse/native") 110 | DOCKER_DEFAULT_ARGS+=("-v ${HOME}/.config/pulse/cookie:$DOCKER_USER_HOME/.config/pulse/cookie") 111 | 112 | # SSH keys 113 | DOCKER_DEFAULT_ARGS+=("-v ${HOME}/.ssh:$DOCKER_USER_HOME/.ssh") 114 | if [[ $IS_ROOT_USER == true ]]; then 115 | DOCKER_DEFAULT_ARGS+=("-v ${DUMMY_SSH_CONFIG}:$DOCKER_USER_HOME/.ssh/config") 116 | fi 117 | 118 | # Mount Jetson cuda libs 119 | if [[ $IS_JETSON = true ]]; then 120 | DOCKER_DEFAULT_ARGS+=("--gpus all") 121 | DOCKER_DEFAULT_ARGS+=("-e NVIDIA_DRIVER_CAPABILITIES=all") 122 | DOCKER_DEFAULT_ARGS+=("-e NVIDIA_VISIBLE_DEVICES=all") 123 | DOCKER_DEFAULT_ARGS+=("--runtime nvidia") 124 | fi 125 | 126 | echo "Container initialized with following arguments:" 127 | echo "docker run "${DOCKER_DEFAULT_ARGS[@]} $DOCKER_CUSTOM_ARGS 128 | echo "" 129 | 130 | docker run ${DOCKER_DEFAULT_ARGS[@]} $DOCKER_CUSTOM_ARGS ; 131 | } 132 | 133 | # Register completion function 134 | docker_alias_completion_wrapper _docker_container_run_and_create drun 135 | 136 | ### 137 | ### Build Docker container 138 | ### 139 | 140 | dbuild() { 141 | 142 | DOCKER_BUILD_ARGS=() 143 | 144 | # Map group and user id 145 | DOCKER_BUILD_ARGS+=("--network host") 146 | DOCKER_BUILD_ARGS+=("--build-arg USER_ID=$(id -u)") 147 | DOCKER_BUILD_ARGS+=("--build-arg GROUP_ID=$(id -g)") 148 | 149 | docker build ${DOCKER_BUILD_ARGS[@]} $@ ; 150 | } 151 | 152 | ### 153 | ### Restart Docker container 154 | ### 155 | 156 | dstart() { 157 | 158 | xhost +si:localuser:root 159 | 160 | docker start -i $@ ; 161 | } 162 | 163 | # Register completion function 164 | docker_alias_completion_wrapper __docker_complete_containers_all dstart 165 | 166 | # Register completion function 167 | docker_alias_completion_wrapper _docker_image_build dbuild 168 | 169 | # Register completion function 170 | docker_alias_completion_wrapper _docker_container_run_and_create drun --------------------------------------------------------------------------------