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.
Go to https://docs.docker.com/install/linux/docker-ce/ubuntu/ and follow the instructions to install docker-ce on Ubuntu.
See Configuring Docker For Use With a Proxy.
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.
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.
We have provided a Dockerfile to build an Ubuntu-based Docker image that has the NCSDK installed.
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 .
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.
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
This command is executed inside of your Docker container.
$ exit
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.)
docker start -a -i ncsdk
These commands are executed from your host terminal, not from inside the Docker container.
docker images
images
command):docker rmi REPOSITORY_NAME
docker container ls -a
container ls
command):docker rm CONTAINER_NAME
docker ps
ps
command):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]]