depthai: Could not be recognized OAK-1 on Docker container

Description of the bug

I tried to use depthai with OAK-1 on Docker container. But, OAK-1 could not be recognized.

$ python3
>>> import depthai
>>> device = depthai.Device('', False)
XLink initialized.
Sending internal device firmware
Failed to boot the device: 1-ma2480, err code 3
depthai: Error initializing xlink

Steps to reproduce the bug

I upload my Dockerfile. https://gist.github.com/atinfinity/c3255077e23164438c19544687e05b84

System information (version)

Device

Host

  • Ubuntu 20.04 64bit
  • Docker 19.03.13

Docker Container

Reference

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 1
  • Comments: 16 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks @tomoaki0705 . And we are still discussing now how to do this the right way. Sorry about the delay.

@atinfinity - we just got this cleanly working so that you can use Docker now (theoretically) without issue. Sorry about the delay, this one turned out to be tricky! We will get updated instructions here shortly. I just saw this PR merge: https://github.com/luxonis/depthai-docs-website/pull/135/files

@atinfinity - so as an update we’re making a better Docker support system, you can see https://github.com/luxonis/depthai-docs-website/pull/115 .

@alex-luxonis Thank you for your quick reply! My issue is solved!

@yoneken It may be possible that the udev rules that would allow access to the USB device in user mode (without sudo) are not installed.

Could you try running these commands taken from our system dependencies install script:

echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"' | sudo tee /etc/udev/rules.d/80-movidius.rules
sudo udevadm control --reload-rules && sudo udevadm trigger

In addition, please unplug and reinsert the USB cable after running the commands.

https://docs.luxonis.com/en/latest/pages/api/#installing-system-dependencies https://docs.luxonis.com/en/latest/_static/install_dependencies.sh

OK, we think we have summarized what we had iterated on internally and with a customer WRT getting Docker to work in a similar (same?) situation. We are now testing it. But in the meantime:

We think it boils down to: (For Linux as far as I know)

  1. compiling libusb without udev inside the cointainer
  2. replacing default libusb to be loaded with the newly compiled (I guess prepending build directory to PATH or LD_LIBRARY_PATH, will do)
  3. Adding the following parameter to docker --device-cgroup-rule='c 189:* rmw

The following should configure, compile and install libusb without udev:

wget https://github.com/libusb/libusb/releases/download/v1.0.24/libusb-1.0.24.tar.bz2
tar xf libusb-1.0.24.tar.bz2
cd libusb-1.0.24
./configure --disable-udev --prefix="$PWD/install_dir" 
make -j
make install
export LD_LIBRARY_PATH="$PWD/install_dir/lib":$LD_LIBRARY_PATH

And at the end set the LD_LIBRARY_PATH to the installation directory.

We’re not exactly sure if that export will persist from docker build to docker usage - might rather replace with ENV LD_LIBRARY_PATH="$PWD/install_dir/lib":$LD_LIBRARY_PATH.

@xtechnicianx is going through and testing/characterizing this.

Thanks and sorry about the delay. We have experience getting DepthAI working in Dockers, but I don’t think we have written it up yet. Slack (globally) was down today, which resulted in us not being able to discuss this as normal until now.

Will circle back. I think we can get the instructions written up soon.

And also, I wanted to say thanks for the great explanation/background here.

Thanks again, Brandon