Skip to content

SIO Setup Tutorial (Docker)

This document walks through the steps required to run SIO Docker image on Ubuntu

Step 1: Ubuntu Upgrades

  • Start with updating and upgrading Ubuntu packages

    sudo apt-get update
    sudo apt-get upgrade
    

Step 2: NVIDIA GPU Drivers Installation

  • Try the following command before continuing with the GPU driver installation instructions to see if they're already installed on the system:

    nvidia-smi
    
  • If the command worked it will show an output similar to the following. If so, skip to Step 3.

  • Follow the instructions on the driver web page: Advanced Driver Search official NVIDIA drivers.

  • Below is an example taken from installation instructions for a RTX 3060 GPU.

    • Once you have downloaded the driver, change to the directory containing the driver package and install the driver by running, as root,

      sudo sh ./NVIDIA-Linux-x86_64-525.60.11.run
      
  • Reboot system

    sudo reboot
    
  • After the reboot, make sure the GPU drivers were successfully installed by running the following command:

    nvidia-smi
    

Step 3: Docker Installation

  • Install the Docker Engine by following the instructions on Docker's website, or use the following commands. If you run into any issues, Docker's page may have troubleshooting info that can help.

  • Uninstall any previous installations

    sudo apt-get remove docker docker-engine docker.io containerd runc
    
  • Update and install required packages for Ubuntu

    sudo apt-get update
    sudo apt-get install \
        ca-certificates \
        curl \
        gnupg \
        lsb-release
    
  • Add Docker GPG key

    sudo mkdir -p /etc/apt/keyrings
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
    
  • Repository setup

    echo \
      "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
      $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
    
  • Install Docker

    sudo apt-get update
    sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
    
  • To verify if the installation worked try the following

    sudo docker run hello-world
    sudo docker compose version
    
  • To use Docker commands without sudo

    sudo usermod -aG docker $USER
    
  • The terminal needs to be restarted for this to take effect, I prefer a reboot

    sudo reboot
    
  • Verify you can run commands without sudo

    docker ps
    

Step 4: NVIDIA Container Toolkit

  • This allows Docker to use the installed GPU. Full documentation can be found on NVIDIA's Installation Guide.

  • Setup package repository and GPG key

    distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
          && curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
          && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \
                sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
                sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
    
  • Install nvidia-docker2

    sudo apt-get update
    sudo apt-get install -y nvidia-docker2
    
  • Restart Docker

    sudo systemctl restart docker
    
  • To verify if the GPU can be used with Docker

    sudo docker run --rm --gpus all nvidia/cuda:11.0.3-base-ubuntu20.04 nvidia-smi
    

Step 5: Get SIO Docker Image

  • The SIO docker image can be obtained from our private registry, once we've created an account for you and provided you with sighthound-keyfile.json:

    cat sighthound-keyfile.json | docker login -u _json_key --password-stdin us-central1-docker.pkg.dev
    docker pull us-central1-docker.pkg.dev/ext-edge-analytics/docker/sio:r240912
    
  • At the end of the command above, r240912 represents the release that can be changed depending on the current release version. Latest release as of September 12, 2024 was r240912.

  • More details are available at Working with SIO framework.

Step 6: Run SIO pipelines

  • Here’s an example that uses the GPU and runs the folder watcher pipeline with the Docker image that we pulled in Step 4.

    docker run -it --gpus all --rm \
    -v /data:/data \
    -e SIO_DATA_DIR=/data \
    us-central1-docker.pkg.dev/ext-edge-analytics/docker/sio:r240912 \
    /sighthound/sio/bin/runPipeline \
    /sighthound/sio/share/pipelines/VehicleAnalytics/VehicleAnalyticsFolderWatch.yaml \
    folderPath=/data/watchedFolder \
    --license-path /data/sighthound-license
    
  • More details are available at Working with SIO framework.