Skip to content

Consider providing a CDI spec file for USB-based cameras (Docker/containers) #115

@gavanderhoorn

Description

@gavanderhoorn

tl;dr: it would be greatly appreciated if Zivid could make a CDI (Container Device Interface) spec available for USB-based Zivid cameras to facilitate passing them through to containers.


original: for a project in which we use a Zivid One Plus M, we're trying to host the ROS driver (and required/related Zivid SDK) in a Docker container.

The camera is a USB device and actually enumerates quite a few devices, all of which seem to have to be available for the driver/SDK to work correctly (if we understand things correctly). The typical approach with Docker would be to pass device nodes to containers using --device (or sometimes as bind-mounts of actual device nodes).

As it's not completely clear which devices belong to the Zivid camera, we're currently passing /dev itself to the container. While this works, it's not very nice, as it pokes a big hole in the isolation typically offered by containers. It's also not always possible, either due to security concerns or other logistical barriers.

The container community has come up with a specification (CDI, the Container Device Interface) which allows to succinctly describe what resources would need to be made available to a container in order to "mount a device" and be able to use it from within that container. As a good example, NVIDIA supports CDI for its various GPUs and accelerators as they are/can be quite complex devices to properly expose to a container.

One of the main motivators for the creation of CDI seems to describe the characteristics of USB-based Zivid cameras well (emphasis mine):

On Linux, enabling a container to be device aware used to be as simple as exposing a device node in that container. However, as devices and software grows more complex, vendors want to perform more operations, such as:

  • Exposing a device to a container can require exposing more than one device node, mounting files from the runtime namespace, or hiding procfs entries.
  • [..]

Instead of reverse-engineering all the required devices and resources ourselves, I'm wondering whether Zivid would consider providing a CDI spec for their USB-based devices. It should make use of these devices in containers (not just Docker, but also Podman fi) quite a bit more straightforward.

If that would not be possible, some guidance on which devices are enumerated after connection of a Zivid One Plus M to a Linux-based OS would be appreciated. The community could then potentially come up with a CDI spec itself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions