How to Install ZED SDK with Docker on Linux

Open in ClaudeOpen in ChatGPT

Setting Up Docker

Install Docker on your host machine.

$# Automatic setup script
$curl -sSL https://get.docker.com/ | sh
$
$# Run a test container to make sure the installation worked
$sudo docker run hello-world

If Docker is correctly installed, you should get a message like this:

$Hello from Docker!
$This message shows that your installation appears to be working correctly.
$
$To generate this message, Docker took the following steps:
$ 1. The Docker client contacted the Docker daemon.
$ 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
$ (amd64)
$ 3. The Docker daemon created a new container from that image which runs the
$ executable that produces the output you are currently reading.
$ 4. The Docker daemon streamed that output to the Docker client, which sent it
$ to your terminal.
$
$To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash
$
$Share images, automate workflows, and more with a free Docker ID:
$ https://hub.docker.com/
$
$For more examples and ideas, visit:
$ https://docs.docker.com/get-started/

To run docker commands without sudo, create a Unix group called docker and add your user to it. Note that the docker group grants privileges equivalent to the root user. For more information, see the Docker post-installation guide.

NVIDIA® Docker

On NVIDIA® Jetson™ boards, skip the step below and go directly to the Docker install guide for NVIDIA® Jetson™.

Install the NVIDIA Container Toolkit using the commands below. It lets you build and run GPU-accelerated Docker containers.

Make sure you have installed the NVIDIA® driver for your graphics card before installing nvidia-container-toolkit.

$# Add the package repository and its GPG key
$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/stable/deb/nvidia-container-toolkit.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
$
$sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit
$sudo systemctl daemon-reload
$sudo systemctl restart docker

For the most up-to-date instructions, refer to the official NVIDIA Container Toolkit installation guide.

Download a ZED SDK Docker Image

To build and run an application with the ZED SDK, you first need to pull a ZED SDK Docker image. The official ZED SDK Docker images are hosted in the StereoLabs DockerHub repository. Releases are tagged by ZED SDK, CUDA, and Ubuntu version, with optional support for OpenGL.

The tag format for desktop images is stereolabs/zed:<sdk>-<variant>-cuda<cuda>-ubuntu<ubuntu>, where <variant> is one of:

  • runtime: the ZED SDK runtime libraries, for production images.
  • devel: the runtime plus the development headers and tools, to build your own applications.
  • gl-devel: the devel image with OpenGL support, required to run graphical tools such as ZED Explorer.

For example, the following commands download a few ZED SDK 5.4 images to your machine:

$docker pull stereolabs/zed:5.4-gl-devel-cuda12.8-ubuntu22.04 # Ubuntu 22.04 development image, ZED SDK 5.4, CUDA 12.8, with OpenGL support
$docker pull stereolabs/zed:5.4-runtime-cuda12.8-ubuntu22.04 # Ubuntu 22.04 runtime image, ZED SDK 5.4, CUDA 12.8
$docker pull stereolabs/zed:5.4-runtime-cuda13.0-ubuntu24.04 # Ubuntu 24.04 runtime image, ZED SDK 5.4, CUDA 13.0

Browse the available tags to find the exact combination of ZED SDK, CUDA, and Ubuntu version that fits your needs. ZED SDK 5.4 desktop images are available for CUDA 12.8 and CUDA 13.0 on Ubuntu 22.04 and 24.04.

Start a Docker Container

To start a container from a ZED SDK image, use the following command:

$docker run --gpus all -it --privileged stereolabs/zed:<container_tag>

The --gpus all flag exposes all available GPUs to the container, and --privileged grants the container access to the camera connected over USB.

For example:

$docker run --gpus all -it --privileged stereolabs/zed:5.4-runtime-cuda12.8-ubuntu22.04

Congratulations, the ZED SDK is now available inside your container!

Test the Docker Container with ZED SDK Capabilities

To verify the installation, we are going to run the ZED Explorer tool. By default, a Docker container can only run command-line applications. To open a display window, we need a container with OpenGL support (a gl-devel image).

$docker pull stereolabs/zed:5.4-gl-devel-cuda12.8-ubuntu22.04 # pull the ZED SDK 5.4 devel image with OpenGL support on Ubuntu 22.04
$xhost +si:localuser:root # allow containers to communicate with the X server
$docker run -it --gpus all --privileged -e NVIDIA_DRIVER_CAPABILITIES=all -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix stereolabs/zed:5.4-gl-devel-cuda12.8-ubuntu22.04
  • --gpus all exposes all available GPUs to the container.
  • -e NVIDIA_DRIVER_CAPABILITIES=all enables the graphics capabilities required by OpenGL.
  • -v /tmp/.X11-unix:/tmp/.X11-unix lets the container access the display.
  • -e DISPLAY makes your DISPLAY environment variable available inside the container.

You can now run any OpenGL application in the container. Let’s launch ZED Explorer:

$/usr/local/zed/tools/ZED_Explorer

You should now see the ZED Explorer GUI running on your display from within a Docker container!

Run a Sample Application

In this example, we will build and run the Depth Sensing sample available in the ZED SDK samples folder.

$apt update && apt install cmake -y
$cp -r /usr/local/zed/samples/depth\ sensing/ /tmp/depth-sensing
$cd /tmp/depth-sensing/cpp ; mkdir build ; cd build
$cmake .. && make
$./ZED_Depth_Sensing

Once you are comfortable running the ZED SDK in Docker, head to Creating a Docker Image for your ZED Application to package your own application.