Intel® Movidius™ Neural Compute SDK

View the Project on GitHub

Using the Intel® Movidius™ Neural Compute SDK with Docker

NOTE: This feature is only available with Intel® Movidius™ Neural Compute SDK 2.x.

Docker is an open-source platform for the creation of lightweight operating-system-level virtualizations called containers for building, distributing, and running applications. Docker images are packages that include everything needed to run the container and its applications, and Docker containers are runtime instances of these images. You can read more about basic Docker concepts here.

The Intel® Movidius™ Neural Compute SDK (Intel® Movidius™ NCSDK) can be installed and run within a Docker container so that its required packages and libraries are isolated from the rest of your system.

This document will tell you how to use the NCSDK with Docker. These instructions assume that you will be using a neural compute device that is connected to your host machine via USB.

Install Docker on an Ubuntu host

Go to https://docs.docker.com/install/linux/docker-ce/ubuntu/ and follow the instructions to install docker-ce on Ubuntu.

Proxy Configuration

See Configuring Docker For Use With a Proxy.

sudo Configuration

To use Docker in Ubuntu without having to use sudo, execute the following commands:

sudo groupadd docker
sudo usermod -aG docker $USER

Reboot your machine for this to take effect.

Other Operating Systems

These instructions have been validated in Docker Community Edition for Ubuntu. Other versions of Docker may not have the required USB support.

These instructions can be done in an Ubuntu virtual machine.

Create a Docker container for the NCSDK

We have provided a Dockerfile to build an Ubuntu-based Docker image that has the NCSDK installed.

1. Build the Docker image

This command will create an image named ‘ncsdk’.

$ docker build -t ncsdk -f ./extras/docker/Dockerfile https://github.com/movidius/ncsdk.git#ncsdk2

This may take some time as the NCSDK is installed and dependencies are built.

If you have already cloned the ncsdk repo, you can instead execute this build command from within the ncsdk directory in the ncsdk2 branch:

$ docker build -t ncsdk -f ./extras/docker/Dockerfile .

2. Create and run a Docker container from the built image

This command will create a container named ‘ncsdk’.

$ docker run --net=host --privileged -v /dev:/dev --name ncsdk -i -t ncsdk /bin/bash

The elevated permissions are necessary for the USB access required by the neural compute device. Additional run options can be seen here. See the instructions above if you need to configure your Docker container to run behind a proxy.

3. Build examples (optional)

You must have a neural compute device connected to a USB port in your host system when running this command. This command is executed inside of your Docker container.

$ make examples

4. Exit the container

This command is executed inside of your Docker container.

$ exit

Use your NCSDK container

Starting the container

The Docker run command creates a new container instance each time that is used. If you want to use your existing container, use the start command. (Note: We named the container ‘ncsdk’ in the run command above.)

Other useful Docker commands

These commands are executed from your host terminal, not from inside the Docker container.

docker images
docker rmi REPOSITORY_NAME
docker container ls -a
docker rm CONTAINER_NAME
docker ps
docker stop CONTAINER_ID

Commit the image (CONTAINER_NAME can be found with the container ls command; REPOSITORY_NAME can be any name for the image).

docker commit CONTAINER_ID [REPOSITORY_NAME[:TAG]]