Containerize DLDT App Using Windows* Docker Container

Published: 09/03/2019  

Last Updated: 09/03/2019

Learn how to:

  1. Build the DLDT Inference Engine on your host Windows* machine
  2. Use the engine to build the Security Camera Demo App from Open Model Zoo, also on your host Windows machine
  3. Run the Security Camera Demo App from inside a Windows Docker container

Step 1: Install Dependencies

To build the Security Barrier Camera Demo, you need to have these programs installed on your system. The versions for Visual Studio* Community and the Intel® C++ Compiler are important.

Note You must install Visual Studio Community before you install the Intel C++ Compiler

Program Version Use
Visual Studio Community Visual C++*

2017 (important)

building DLDT and security camera demos
Intel C++ Compiler 19.0 (important) building DLDT (absolutely necessary for certain builds to complete)
Docker* 18.09.2 building and running the Docker container
CMake* 3.14.5 generating VS 2017 solutions
Git* pulling from various repos
Python* 3 (not Python 2) 3.6.8 downloading open_model_zoo models
GNU Wget 1.11.4 downloading various packages for CMake

Visual Studio* Community 2017

  1. Download the Visual Studio Installer
  2. Only download the Desktop development with C++ workload

Intel® C++ Compiler

  1. Download the Intel® Parallel Studio XE package installer. You will need to get a license for it (use the free trial or a student account). Make sure to select the customizable installer from the download page
  2. Intel Parallel Studio XE
    1. Intel C++ Compiler 19.0 Update 4
    2. Intel® Threading Building Blocks (Intel® TBB) 2019 Update 6

      Note The Intel® Debugger Extension 8.2 may be automatically checked. You may leave it checked or uncheck it.

    3. On the top right corner, you may choose to uncheck the box next to IA-32 (it is not needed)
    4. If you follow these, your installation size (shown in the GUI) should be about 1.8 GB.
  3. Select whether to consent to your information being collected
  4. Next to IDE Integration, select Customize. Choose Visual Studio 2017 as your integration target
  5. Proceed to install the packages you selected

Note The installation might take a while (~30 minutes to over 1 hour) with no progress update. Make sure to be patient and let the Finish button show up or else it will not install properly


  1. Download Docker Desktop
  2. After the installation completes, you will be prompted to log out
  3. Log back in. On startup, Docker will ask you if you want to enable Hyper-V. Click Yes and you will be prompted to restart your computer. If you are never prompted to enable Hyper-V, see how to do so manually here
  4. Right click Docker icon in the taskbar menu and select Switch to Windows containers
  5. Right click Docker icon, go to Settings
    1. In General, check Expose daemon on
    2. If you are working behind a proxy, in Proxies, check Manual proxy configuration and add your configurations
    3. Make sure to click Apply to properly apply these settings. You will have to restart Docker
  6. You are now ready to use Docker


Step 2: Configure Proxies (only if needed)

If you are operating behind a proxy, make sure to set your HTTP_PROXY and HTTPS_PROXY environment variables to your corresponding proxy server addresses.

Step 3: Build the DLDT Inference Engine

Note The steps to build the DLDT Inference Engine can also be found here.

First, clone dldt and its submodules:

git clone
cd dldt
git checkout 2019
cd inference-engine 
git submodule init 
git submodule update --recursive

Note On rare occasion, git submodule init and git submodule update --recursive will fail to pull from the ade repository. Pay attention to possible error logs. You many need to check dldt\inference-engine\thirdparty\ade to see if it is empty. If it is empty, you will need to manually clone ade from this repo.

Next, build the Visual Studio solution files. Pay attention to the parameters you pass into CMake.

Note that specifying the Intel C++ Compiler via the -T flag (as opposed to MSVC, etc.) is mandatory, or else many essential libraries (i.e. MKLDNNPlugin.dll) will fail to build.

  • Make sure to change the Intel C++ Compiler version in your command syntax to match whichever version you have installed (if you are not using version 19.0)
  • Make sure to specify the Win64 Visual Studio generator, or else the process will silently fail
mkdir build
cd build
cmake .. -G "Visual Studio 15 2017 Win64" -T "Intel C++ Compiler 19.0" -DCMAKE_BUILD_TYPE=Release -DICCLIB="C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019\windows\compiler\lib"

Note If this fails, try running this command on the Intel Compiler 19.0 Update 4 Intel(R) 64 Visual Studio 2017 shell environment. It should be located at C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Intel Parallel Studio XE 2019\Compiler and Performance Libraries\Command Prompt with Intel® Compiler 19.0 Update 4.

Finally, build the executables:

cmake --build . --config Release

Note You must build in Release mod. Failing to build in Release mode will cause the Security Barrier Camera Demo to fail to build later on (it will not recognize the Directory name or the names of several .dll's)

Step 4: Build OpenCV

First, clone OpenCV. 4.1.1 was used during the creation of the article.

git clone

Next, build the OpenCV solution files, and then OpenCV.

cd ...\opencv 
mkdir build 
cd build 
cmake -G "Visual Studio 15 2017 Win64" ..
cmake --build . --config Release

Note The DLDT repository actually contains all the necessary OpenCV libraries for building the camera demo. However, building the app using the original repository solves some problems with decoding .mp4 videos inside the Windows Docker container.

Step 5: Build Security Camera Barrier Demo from Open Model Zoo

Note The steps to build the demo can also be found here.

First, clone the Open Model Zoo repository and switch to the 2019 branch.

git clone
cd open_model_zoo
git checkout 2019

We want to build the demos manually using the Inference Engine libraries from dldt, so we set the InferenceEngine_DIR environment variable to the dldt build directory (your path depends on where your dldt folder is located):

$env:InferenceEngine_DIR = "...dldt\inference-engine\build"

We want to use the OpenCV libraries from our own installation of OpenCV, not the libraries included in the dldt repo), so we will set the OpenCV_DIR environment variable to the directory containing the OpenCVConfig.cmake file.

$env:OpenCV_DIR = "...\opencv\build"

Note (See note in Step 3) Alternatively, you may link the OpenCV directory inside the dldt repo:

$env:OpenCV_DIR = "...\dldt\inference-engine\temp\opencv_4.1.0\cmake"

Note The benefit of this is that you don't actually need to install OpenCV from its own repo (you can skip step 3). However, if you do this, the demo application will not be able to read .mp4 files.

Next, we simply run

cd demos

to build the demos. The demos, including security_barrier_camera_demo.exe, are found in C:\Users\<username>\Documents\Intel\OpenVINO\omz_demos_build_build\intel64\Release , where <username> is your account username.

Download Models

In order to download the appropriate models for the security barrier camera demo, we run these commands:

pip install requests 
pip install pyyaml

cd ...\open_model_zoo\model_downloader 

python .\ --name 'vehicle-license-plate-detection-barrier-0106,vehicle-attributes-recognition-barrier-0039,license-plate-recognition-barrier-0001'

The script downloads these three models, all of which will be used by security_barrier_camera_demo.exe:

  • vehicle-license-plate-detection-barrier-0106
  • vehicle-attributes-recognition-barrier-0039
  • license-plate-recognition-barrier-0001

A full list of models can be found here. However, these are the only models you should download for the security barrier camera app demo.

At this point, everything we need is built, and all we need to do is transfer necessary files to the Docker container.

Step 6: Aggregating Dynamic Libraries

In order for security_camera_barrier_demo.exe to run, it must have access to the .dll's below.

Note The IntelSWTools libraries come with installing the Intel C++ Compiler.

File Directory Library Files
dldt\inference-engine\bin\intel64\Release(DLDT) cpu_extension.dll
C:\Program Files (x86)\IntelSWTools\...* libmmd.dll
opencv\build\bin\Release (OpenCV) opencv_core411.dll
opencv\build\3rdparty\ffmpeg (OpenCV) opencv_videoio_ffmpeg411_64.dll
dldt\inference-engine\temp\tbb\lib (DLDT) tbb.dll


We also need some .dll's that come with the Visual C++ runtime, which are found in System32 on your host. You do not need to copy these files into the Docker container, however, as we can install the Visual C++ runtime via Dockerfile.

File Directory Library Files
C:\Windows\System32 vcruntime140.dll

Make these .dll's accessible by either placing them in the same folder as the executable, or adding the directories containing them to your PATH.

Step 7: Building the Docker Image

Before we run docker build, we need to arrange all the necessary files in a special format so that we can copy them into the Docker container.

Here is a file structure guide and a list of files that must be put inside the Docker container.

File Structure

├── Dockerfile 
├── security_barrier_camera_demo.exe 
├── vc_redist.x64.exe 
├── models 
|   ├── license-plate-recognition-barrier-0001.bin 
|   ├── license-plate-recognition-barrier-0001.xml 
|   └── ... (6 files total) 
└── bin 
    └── (all necessary .dll files)

List of Files

  • security_barrier_camera_demo.exe
    • Found in ...\Documents\Intel\OpenVINO\omz_demos_build\intel64\Release
    • This is the security camera demo app
  • vc_redist.x64.exe
    • You may download it from here.
    • This executable will be used to install the Visual C++ runtime.
  • All of the .dll files listed above (in the table)
    • Comprehensive list:
      • cpu_extension.dll
      • format_reader.dll
      • inference_engine.dll
      • MKLDNNPlugin.dll
      • libmmd.dll
      • svml_dispmd.dll
      • opencv_core411.dll
      • opencv_highgui411.dll
      • opencv_imgproc411.dll
      • opencv_imgcodecs411.dll
      • opencv_videoio411.dll
      • opencv_videoio_ffmpeg411_64.dll
      • tbb.dll
      • tbb_debug.dll
      • tbbmalloc.dll
      • tbbmalloc_debug.dll
  • Compressed machine learning models from Open Model Zoo (both the .bin and .xml files for each)
    • License Plate Recognition Barrier Model
      • Found in open_model_zoo\model_downloader\Security\object_attributes\vehicle\resnet10_update_1\dldt
    • Vehicle Attributes Recognition Barrier Model
      • Found in open_model_zoo\model_downloader\Security\object_detection\barrier\0106\dldt
    • Vehicle License Plate Detection Barrier Model
      • Found in open_model_zoo\model_downloader\Security\optical_character_recognition\license_plate\dldt

Docker build

Go to the directory containing your Dockerfile and build the image.

cd <directory with Dockerfile in it> 
docker build -t security-app .

Note Pulling the Windows amd-64 image may take a long time, and at times you may see full progress bars with no progress update (during "Extracting" phase) for over 20 minutes. Be patient. Check your task manager, and if Docker is still running, it means that the build is probably working, even if it may not seem so.


To create the dockerfile, save the code below as Dockerfile without an extension.

Note If you see errors on build such as a Windows version XXX-based image is incompatible with XXX host, check your Windows version. The provided Dockerfile uses the Windows 10 1903 base image, but an older Windows host cannot run a newer Windows container. For example, if your Windows Version is Windows 10 1809, you will need to edit the base image to

# escape=` 

# Use full Windows image (Server Core and Nano Server lack some library files) 

# Copy files over 
COPY ["bin", "C:/demo/bin"] 
COPY ["models", "C:/demo/models"] 
COPY ["security_barrier_camera_demo.exe", "C:/demo/security_barrier_camera_demo.exe"] 

# Install Visual C++ runtime 
COPY ["vc_redist.x64.exe", "C:/temp/vc_redist.x64.exe"] 
RUN C:\temp\vc_redist.x64.exe /install /quiet /norestart 

# Default to Powershell when running 
SHELL ["powershell.exe", "-ExecutionPolicy", "Bypass"] 

# Add bin to PATH 
RUN $newpath = $env:path + "';C:\demo\bin;C:\demo'" ; ` 
    Set-ItemProperty -Path `
        'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' `
        -Name PATH -Value $newpath

Step 7: Running in Docker Container

Use the command below to run the camera demo in the Docker container.

  • [$path] should be the absolute path to the folder containing the images or videos you want to run the app on.
    • i.e. you may download this image of a car, and if the image's full path is "/home/folder/car_1.bmp", replace [$path] with "/home/folder".Car Image
  • The -no_show and -r flags are used to make sure that the application output is printed as text (as we cannot view image or video output from the Docker container).
docker run -v [$path]:C:\media -it security-app security_barrier_camera_demo -i C:/media/car_1.bmp -d CPU -d_va CPU -d_lpr CPU -m C:/demo/models/vehicle-license-plate-detection-barrier-0106.xml -m_va C:/demo/models/vehicle-attributes-recognition-barrier-0039.xml -m_lpr C:/demo/models/license-plate-recognition-barrier-0001.xml -no_show -r

If everything works properly, the output should print some inference results describing the car and its license plate.

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at