> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.stereolabs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.stereolabs.com/_mcp/server.

# Orchestrate containers

You are free to choose any orchestrator to manage the containers running the ZED SDK.

Below are examples for two popular orchestrators: **Docker Compose** and **Kubernetes**.

## Docker Compose

[Docker Compose](https://docs.docker.com/compose/) is quick to set up. You just need to make sure that every Docker runtime parameter mentioned in the rest of this documentation is also present in your `docker-compose.yaml` file:

* The `privileged` mode.
* The `nvidia` runtime.
* The `NVIDIA_DRIVER_CAPABILITIES` environment variable.
* The [shared volumes](/docs/integrations/docker/create-docker-images#volumes).

> **Note**
>
> The `runtime: nvidia` key requires the Compose file format `2.3` (or `2.4`), which is why the examples below use that version.

Once you have completed the setup, you are ready to go. You can try it out with the example service we provide.

<details>
  <summary>
    USB camera example
  </summary>

  ```yml
  version: '2.3'
  services:
    your_app:
      image: <your-image>
      runtime: nvidia
      environment:
       - NVIDIA_DRIVER_CAPABILITIES=all
      privileged: true
      volumes:
        - /usr/local/zed/resources:/usr/local/zed/resources
        - /usr/local/zed/settings:/usr/local/zed/settings
        - /dev:/dev
  ```
</details>

<details>
  <summary>
    GMSL2 camera example (ZED X, ZED X One)
  </summary>

  ```yml
  version: '2.3'
  services:
    your_app:
      image: <your-image>
      runtime: nvidia
      environment:
       - NVIDIA_DRIVER_CAPABILITIES=all
      privileged: true
      volumes:
        - /usr/local/zed/resources:/usr/local/zed/resources
        - /usr/local/zed/settings:/usr/local/zed/settings
        - /var/nvidia/nvcam/settings/:/var/nvidia/nvcam/settings/
        - /etc/systemd/system/zed_x_daemon.service:/etc/systemd/system/zed_x_daemon.service
        - /tmp/:/tmp/
        - /dev:/dev
  ```
</details>

## Kubernetes

To use Kubernetes, we recommend setting up a cluster with [k3s](https://k3s.io/).
Adding NVIDIA® Container Runtime support to k3s takes a few steps, [described here](https://docs.k3s.io/advanced#nvidia-container-runtime-support).

* Make sure the NVIDIA container runtime is properly installed. You can check it in the `/etc/docker/daemon.json` file:

```json
{
    "default-runtime": "nvidia",
    "runtimes": {
        "nvidia": {
            "args": [],
            "path": "nvidia-container-runtime"
        }
    }
}
```

* Add a `RuntimeClass` to your Kubernetes configuration:

```yml
apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata:
  name: nvidia
handler: nvidia
```

* Reference the runtime class in the target pod:

```yml
spec:
  runtimeClassName: nvidia
```

* You may also need to install the NVIDIA device plugin in your cluster (check the [k8s-device-plugin](https://github.com/NVIDIA/k8s-device-plugin) repository for the latest release): `sudo k3s kubectl create -f https://raw.githubusercontent.com/NVIDIA/k8s-device-plugin/v0.14.1/nvidia-device-plugin.yml`

Once you have completed the setup, you are ready to go. You can try it out with the example pod we provide.

<details>
  <summary>
    Example pod configuration file for USB cameras
  </summary>

  ```yml
  apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: zed-sample
  spec:
    replicas: 1
    selector:
      matchLabels:
        app: your-app
    template:
      metadata:
        labels:
          app: your-app
      spec:
        containers:
          - name: your-container
            image: <your_image>
            securityContext:
              privileged: true
            env:
              - name: NVIDIA_DRIVER_CAPABILITIES
                value: "all"
            volumeMounts:
              - name: dev
                mountPath: dev

            command: ["tail", "-f", "/dev/null"]
            resources:
              limits:
                nvidia.com/gpu: 1 # Assuming you want to allocate one GPU
              requests:
                nvidia.com/gpu: '1'
        volumes:
          - name: dev
            hostPath:
              path: /dev
  ```
</details>

For [GMSL2](/docs/products/embedded/zed-link-capture-card/gmsl2#what-is-gmsl2) cameras, add the same [additional shared volumes](/docs/integrations/docker/create-docker-images#volumes) as before.