• Error when trying to run depthai-python API in a Docker container

Hi Jaka,

This is for the OAK-D PoE and OAK-D S2 PoE. These are both network devices, not USB. But still I want to try your suggestions because I am familiar with Docker and priviledges.

What do you mean by (1) ? How do I ensure?

This is what I get inside the container:

docker run --rm -it    --privileged --net=host    -v /dev/bus/usb:/dev/bus/usb     --device-cgroup-rule='c 189:* rmw'     -e DISPLAY=$DISPLAY     -v /tmp/.X11-unix:/tmp/.X11-unix     luxonis/depthai-library:latest bash
root@docker-desktop:/# ls /dev/bus
usb
root@docker-desktop:/# ls /dev/bus/usb
root@docker-desktop:/#

Regarding (2): macOS does not have /dev/busSo, I don't understand what you are mapping with -v option.

I have verified (3) and (4) using this. I can run X11 apps (e.g. xeyes, gnome-calculator, xclock) and display them in XQuartz.

Also, since the Luxonis image does not have ifconfig, I used the bash image to verify that --net=host is actually granting access to all the network interfaces of the host.

To diagnose this further, I think we should ignore the GUI/display part (since I know this is working with other images) and focus on the networking and USB parts. So, I tried bootloader_version.pywhich is a terminal-only CLI:

docker run --rm     --privileged --net=host    -v /dev/bus/usb:/dev/bus/usb     --device-cgroup-rule='c 189:* rmw'     -e DISPLAY=$DISPLAY     -v /tmp/.X11-unix:/tmp/.X11-unix     luxonis/depthai-library:latest     python3 /depthai-python/examples/bootloader/bootloader_version.py
[2023-09-06 12:42:48.498] [depthai] [warning] USB protocol not available - If running in a container, make sure that the following is set: "-v /dev/bus/usb:/dev/bus/usb --device-cgroup-rule='c 189:* rmw'"
No devices found

Still the same error.

Are you sure you have tried running the Luxonis docker image on Docker Desktop for macOS ?

  • erik replied to this.

    Hi Craftonix ,
    Does it work outside docker, on the macos directly?

    Yes, as I already mention in the first sentence of this post: "I am able to successfully run depthai-python API examples natively on macOS and I have been developing this way for a while."

      Hi Craftonix
      Could you try pinging the device to see if it can correctly access it. I would assume you are running them through a router?

      Thanks,
      Jaka

      Yes, I can ping the device from inside my container. Both the device and my laptop (which is running Docker Desktop for macOS) are connected to the same router which gives them a DHCP address. Somthing like:

      Device: 192.168.1.22
      Laptop: 192.168.1.36

        Hi Craftonix
        That's very strange. Have you tried directly specifying the IP address using DeviceInfo?
        What bootloader version are you using?

        Thanks,
        Jaka

        a month later

        I'm also have a similar issue.
        I'm running docker desktop on Mac m2

        OAK 1 D POE

        This is the error:
        [2023-10-05 18:48:42.156] [depthai] [warning] USB protocol not available - If running in a container, make sure that the following is set: "-v /dev/bus/usb:/dev/bus/usb --device-cgroup-rule='c 189:* rmw'"

        this is from my docker-compose:
        devices:

        • /dev/bus/usb:/dev/bus/usb

        command: ["--device-cgroup-rule=c 189:* rmw"]

        if I test the camera directly on the host it runs. But in docker I can't access.

          Hi keggy
          AFAIK there is currently no USB pass-through option for MacOS, since it doesn't expose the ports as linux does: /dev/bus/usb:/dev/bus/usb.
          You will need to make a VM/use parallels to achieve that on a mac.

          Thanks,
          Jaka

            jakaskerl thanks for the reply. Even if I use the OAK with POE?
            I use an USB-C<-> Lan Adapter.

            I als try do run it on my VM but my Mac is with Apple Silicon.
            I let u know

            I tried on Ubuntu VM in Parallels and it worked!

            and as suggested I use in my Docker-Compose
            "…

            devices:

              - /dev/bus/usb:/dev/bus/usb

            …"

              keggy I don't understand: are you running Docker inside the Ubuntu VM ?

                Craftonix

                At first I tried directly with docker desktop on may Mac.

                Then i installed docker (but not desktop) on my Ubuntu VM which is running in parallels