Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Alert: This site is migrating to our new home at Please visit us there!

NCS access in a docker container in VirtualBox on Mac OSX

I've been trying to get the NCS to work in a docker container (based on Ubuntu 16.04) running in a Virtualbox VM on a Mac OSX (10.11) machine. I'm reaching out to ask for any advice about this.

I've set up and built the ncsdk and examples (NCSDK- in my container. One issue I always see is that the that runs when doing a "make install" always fails & aborts at line no. 609. So I end up running the remaining 3 commands manually, & they all succeed.
$SUDO_PREFIX udevadm control --reload-rules
$SUDO_PREFIX udevadm trigger
$SUDO_PREFIX usermod -a -G users root (docker container starts as root user)

I have configured the USB port and filters in VirtualBox using information from here. Inside my docker container I can see the NCS correctly when I do usb-devices or lsusb -v.

However, when I try to run an example its never able to open the NCS device. E.g., this is the output from the hello_ncs_py:
making run
Error - Could not open NCS device.

Based on information I found on the internet and ncsforum, I've tried running the container using a few different parameters, e.g:
docker run -it --net=host --device=/dev/bus/usb:/dev/bus/usb:rwm dockrohit/ncsdk-b2d:v1.1 /bin/bash
docker run -it --net=host --privileged -v /dev/bus/usb:/dev/bus/usb dockrohit/ncsdk-b2d:v1.1 /bin/bash
(also ran both of these without the --net=host option as well)

But I can't get this to work. Sample program is never able to open the NCS device.

Can someone give me any other pointers that might help me to get this working?

Interestingly, when I look at the output from dmesg after running sample code, I see the following output that indicates that the usb device gets disconnected and reconnected.

[ 0.000000] usb 2-1: USB disconnect, device number 3
[ 0.000000] usb 1-1: new high-speed USB device number 4 using xhci_hcd

I would very much appreciate any help on this.



  • 3 Comments sorted by Votes Date Added
  • Ok so I found a hacky fix. Seems that in usb_find_device (ncsdk/api/src/usb_boot.c), libusb doesn't seem to pick up the changes in the usb enumeration when Movidius shape shifts into USB 3 mode. I re-inited libusb in usb_find_device and now the changed usb vid/pid are picked up. See below for the hack. There is probably a better fix.

    int usb_find_device(unsigned idx, char *addr, unsigned addr_size, void **device,
                        int vid, int pid)
            static libusb_device **devs;
            libusb_device *dev;
            struct libusb_device_descriptor desc;
            int count = 0;
            size_t i;
            int res;
            // FIX v
            // FIX ^
            if (!initialized) {
                               "Library has not been initialized when loaded\n");
                    return MVNC_ERROR;
  • I am having the exact same problem (docker container inside of Parallels). It seems that it fails when trying to re-acquire the NCS after it loads firmware. See output:

    >>> from mvnc import mvncapi as mvnc
    >>> mvnc.SetGlobalOption(mvnc.GlobalOption.LOG_LEVEL, 2)
    >>> devices = mvnc.EnumerateDevices()
    Device 0 Address: 10 - VID/PID 03e7:2150
    >>> device = mvnc.Device(devices[0])
    >>> device.OpenDevice()
    Starting wait for connect with 2000ms timeout
    Found Address: 10 - VID/PID 03e7:2150
    Found EP 0x81 : max packet size is 512 bytes
    Found EP 0x01 : max packet size is 512 bytes
    Found and opened device
    Performing bulk write of 905640 bytes...
    Successfully sent 905640 bytes of data in 184.755151 ms (4.674758 MB/s)
    Boot successful, device address 10
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/usr/local/lib/python3.5/dist-packages/mvnc/", line 147, in OpenDevice
        raise Exception(Status(status))
    Exception: mvncStatus.ERROR
  • Can confirm for the case of just using a docker container on ubuntu16.04. The fix proposed by @tripleplay369 works!

Sign In or Register to comment.