Is it possible to run Kinect V2 inside a Docker container?

9

I'm exploring the feasibility of running a C# Kinect Visual Gesture Program (something like Continuous Gesture Basics project https://github.com/angelaHillier/ContinuousGestureBasics-WPF) inside of a Docker for Windows container.

  1. Is this even theoretically possible (run C# Kinect in a Docker for Windows container?)

  2. If the answer to 1 is yes, here are some extra details:

I'm using the microsoft/dotnet-framework:4.7 image as a basis and my initial Dockerfile looks like this:

FROM microsoft/dotnet-framework:4.7
ADD . /home/gesture
WORKDIR /home/gesture

Build the image:

$ docker build -t kinect .

Turn on container:

$ docker run -dit --name kinectContainer kinect

Attach to a powershell session to monkey around:

$ docker exec -it kinectContainer powershell

When I attempt to run my gesture application from the Docker container I get the following error (which is expected since no Kinect SDK was installed in the container):

Unhandled Exception: System.BadImageFormatException: Could not load file or assembly 'Microsoft.Kinect, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependenc
ies. Reference assemblies should not be loaded for execution.  They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058) ---> System.BadImageFormatExcep
tion: Cannot load a reference assembly for execution.                                           erable program. Check the spelling of the name, or if a path was included, verify that the path
   --- End of inner exception stack trace ---
   at GestureDetector.GestureDetectorApp..ctor()

At this point, the big question is how to install the Kinect v2 SDK [KinectSDK-v2.0_1409-Setup.exe] or the Kinect v2 runtime [KinectRuntime-v2.0_1409-Setup.exe] in the container.

The installers have a EULA and according to some clever University of Wisconsin folks, there is a technique to to extract installers using Wix's dark.exe decompiler(https://social.msdn.microsoft.com/Forums/en-US/a5b04520-e437-48e3-ba22-e2cdb46b4d62/silent-install-installation-instructions?forum=kinectsdk)

ex.

$ & 'C:\Program Files (x86)\WiX Toolset v3.11\bin\dark.exe' C:\installerwork\KinectRuntime-v2.0_1409-Setup.exe -x c:\installerwork\kinect_sdk_installersfiles

The issue I ran into when I got to the underlying msi files is there is no option to run them silently using msiexec.

I've figured out that the runtime installer (Runtime installer (KinectRuntime-x64.msi) extracted from the Kinect v2 SDK) makes at least the following changes in the filesystem:

Creates a folder "Kinect" in C:\Windows\System32 and adds 3 files to System 32:

k4wcll.dll

kinect20.dll

microsoft._kinect.dll

The last three files in System32 should be the 64-bit versions (the installer appears to have x86 and x64 versions of those 3)

Replicating those changes by hand does not lead to success on the host machine let alone in the container.

It's currently unclear what other registry/system changes are occurring with the installer (and whether or not that would get us over the goal line in the Docker container)

Any ideas about how to proceed from here?

c#
windows
docker
wix
kinect
asked on Stack Overflow Dec 13, 2017 by Victor

2 Answers

2

In short no. docker on windows does not have the ability to hardware tunnel/map. on Linux, it does via the --device= option

As @VonC has stated you will need to use a Windows VM this could be Hyper-V or you can use Virtual Box then you can provide the Kinect Hardware via the Tunneling method (add/connect device), without this there would be no way for your container be that VM or not to access the hardware of the host machine with windows.

answered on Stack Overflow Dec 21, 2017 by Barkermn01
0

Another approach would be to try and install Kinetic in a Windows server VM, and detect the exact changes brought by said installation.

See for instance "How can I find out what modifications a program’s installer makes?" and a tool like ZSoft Uninstaller 2.5.

Once you have determined exactly what files/registry/variables are impacted by the installation process, you can replicate that in a Dockerfile.

answered on Stack Overflow Dec 16, 2017 by VonC

User contributions licensed under CC BY-SA 3.0