I've actually been running into a similar issue. It looks like regardless of what I do, I keep getting the same issue to persist. My goal is to run both the rgb_preview and the deptahi_demo.py examples in the same docker container on my unbuntu desktop.
I initially tried using the depthai-library image from (https://hub.docker.com/r/luxonis/depthai-library). When using that image, I was able to connect to my OAK-D and ran the rgb_preview.py example. However, when I tried cloning depthai.git and installing the requirements into the container to run depthai_demo.py, I'd get the following error:
File "depthai_demo.py", line 18, in <module>
from depthai_helpers.arg_manager import parseArgs
File "/app/depthai/depthai_helpers/arg_manager.py", line 10, in <module>
from depthai_sdk.previews import Previews
File "/app/depthai/depthai_sdk/src/depthai_sdk/init.py", line 4, in <module>
from .managers import *
File "/app/depthai/depthai_sdk/src/depthai_sdk/managers/init.py", line 4, in <module>
from .pipeline_manager import PipelineManager
File "/app/depthai/depthai_sdk/src/depthai_sdk/managers/pipeline_manager.py", line 7, in <module>
class PipelineManager:
File "/app/depthai/depthai_sdk/src/depthai_sdk/managers/pipeline_manager.py", line 32, in PipelineManager
_depthConfig = dai.StereoDepthConfig()
AttributeError: module 'depthai' has no attribute 'StereoDepthConfig'
Assuming some packages may have been missing, I created a dockerfile to install all the dependencies from install_dependencies.sh. However, when I tried to run depth_demo.py in a container, it gave the same issue.
I then tried using the base image instead in my dockerfile, (https://hub.docker.com/r/luxonis/depthai-base). While I was no longer getting the error from before, I kept getting an error saying
File "ColorCamera/rgb_preview.py", line 24, in <module>
with dai.Device(pipeline) as device:
RuntimeError: Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND
and a similar error when I attempted to run depthai_demo.py. I tried including the following below to my docker file, however that didn't work either.
RUN 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
ENV LD_LIBRARY_PATH="$PWD/libusb-1.0.24/install_dir/lib":$LD_LIBRARY_PATH
Then I tried using a python base image similar to https://github.com/luxonis/depthai-docker/blob/master/Dockerfile-depthai however it was missing all the dependencies. I went back and updated the dockerfile to include the install_dependencies.sh but ran into the same issue again where the device couldn't be found as shown below.
File "depthai_demo.py", line 575, in run
self.instance.run_all(self.conf)
File "depthai_demo.py", line 76, in run_all
self.setup(conf)
File "depthai_demo.py", line 153, in setup
self.device = dai.Device(self.pm.pipeline.getOpenVINOVersion(), self.deviceInfo, usb2Mode=self.conf.args.usbSpeed == "usb2")
Failed to find device after booting, error message: X_LINK_DEVICE_NOT_FOUND
All the containers used the same arguments of
docker run --rm -it\
--privileged \
-v /dev/bus/usb:/dev/bus/usb \
--device-cgroup-rule='c 189:* rmw' \
-e DISPLAY=$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix \
--entrypoint /bin/bash imageName
Each dockerfile also included RUN echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"' | tee /etc/udev/rules.d/80-movidius.rules in case it wasn't set. I'm able to see the usb from within the container and even hear an initial click sometimes but it never connects to it.
Please advise.