是否可以在Docker容器中运行Kinect V2?

问题描述 投票:8回答:2

我正在探索在(something like Continuous Gesture Basics project https://github.com/angelaHillier/ContinuousGestureBasics-WPF)中运行C#Kinect视觉手势程序Docker for Windows container.的可行性

  1. 这在理论上是否可行(在Docker for Windows容器中运行C#Kinect?)
  2. 如果1的答案是肯定的,这里有一些额外的细节:

我正在使用microsoft / dotnet-framework:4.7图像作为基础,我的初始Dockerfile如下所示:

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

构建图像:

$ docker build -t kinect .

打开容器:

$ docker run -dit --name kinectContainer kinect

附加到PowerShell会话以围绕:

$ docker exec -it kinectContainer powershell

当我尝试从Docker容器运行我的手势应用程序时,我收到以下错误(由于容器中没有安装Kinect SDK,因此预计会出现这种情况):

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()

在这一点上,最大的问题是如何在容器中安装Kinect v2 SDK [KinectSDK-v2.0_1409-Setup.exe]Kinect v2 runtime [KinectRuntime-v2.0_1409-Setup.exe]

安装程序有一个EULA,根据some clever University of Wisconsin folks,有一种技术可以使用Wix的dark.exe反编译器(https://social.msdn.microsoft.com/Forums/en-US/a5b04520-e437-48e3-ba22-e2cdb46b4d62/silent-install-installation-instructions?forum=kinectsdk)提取安装程序

恩。

$ & '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

我到达底层msi文件时遇到的问题是没有选项可以使用msiexec以静默方式运行它们。

我已经发现运行时安装程序(从Kinect v2 SDK中提取的运行时安装程序(KinectRuntime-x64.msi))至少在文件系统中进行了以下更改:

在C:\ Windows \ System32中创建一个文件夹“Kinect”,并将3个文件添加到System 32:

k4wcll.dll

kinect20.dll

mitsrosoft._kinetst.dl

System32中的最后三个文件应该是64位版本(安装程序似乎有这些3的x86和x64版本)

手动复制这些更改并不会导致主机成功,更不用说在容器中了。

目前还不清楚安装程序发生了哪些其他注册表/系统更改(以及是否会让我们超过Docker容器中的目标行)

关于如何从这里开始的任何想法?

c# windows docker wix kinect
2个回答
1
投票

总之没有。 Windows上的docker没有硬件隧道/地图的能力。在Linux上,它通过--device=选项

正如@VonC所说,您需要使用Windows VM,这可能是Hyper-V,或者您可以使用Virtual Box,然后您可以通过隧道方法(添加/连接设备)提供Kinect硬件,没有这个就没有办法对于您的容器,该VM是否可以通过Windows访问主机的硬件。


0
投票

另一种方法是尝试在Windows服务器VM中安装Kinetic,并检测所述安装带来的确切更改。

例如,参见“How can I find out what modifications a program’s installer makes?”和像ZSoft Uninstaller 2.5这样的工具。

一旦确定了安装过程影响了哪些文件/注册表/变量,就可以在Dockerfile中复制它。

© www.soinside.com 2019 - 2024. All rights reserved.