我正在尝试在Windows主机上创建Azure IoT Edge设备,但正在运行作为Linux容器构建的模块。在先前的实验中,我能够在Linux主机上成功创建Azure IoT Edge设备,并成功运行了相同的Linux容器模块。
但是,当我将该模块部署到Windows主机上时,该模块显示它没有运行,并且当我使用“ iotedge logs camera-capture”查看该模块的日志时,出现以下错误:
<6> 2019-12-02 13:32:56.016 -08:00 [INF] - Executing command: "Create module camera-capture"
<3> 2019-12-02 13:33:11.674 -08:00 [ERR] - Executing command for operation ["create"] failed.
Microsoft.Azure.Devices.Edge.Agent.Edgelet.EdgeletCommunicationException- Message:Error calling Create module camera-capture: Could not create module camera-capture
caused by: Could not pull image localhost:5000/camera-capture-opencv:1.1.128-amd64
caused by: image operating system "linux" cannot be used on this platform, StatusCode:500, at: at Microsoft.Azure.Devices.Edge.Agent.Edgelet.Version_2019_01_30.ModuleManagementHttpClient.HandleException(Exception exception, String operation) in C:\agent\_work\4\s\edge-agent\src\Microsoft.Azure.Devices.Edge.Agent.Edgelet\version_2019_01_30\ModuleManagementHttpClient.cs:line 194
关于此特定错误,我无法在线或通过Microsoft论坛找到任何可解决我问题的结果。作为记录,我确保:
任何帮助将不胜感激!
答案 0 :(得分:0)
花了几天时间解决这个问题后,我终于找到了解决方案。问题在于Windows上的IoT Edge运行时未配置为处理Linux容器! 撰写本文时,Microsoft在此处记录了该解决方案:https://docs.microsoft.com/en-us/azure/iot-edge/how-to-install-iot-edge-windows-with-linux
但是如果将来出现死链接,则基本上必须在安装Azure IoT Edge运行时来处理Linux容器时添加其他标志。
. {Invoke-WebRequest -useb aka.ms/iotedge-win} | Invoke-Expression; `
Deploy-IoTEdge -ContainerOs Linux
. {Invoke-WebRequest -useb aka.ms/iotedge-win} | Invoke-Expression; `
Initialize-IoTEdge -ContainerOs Linux
答案 1 :(得分:0)
我将Docker Desktop更改为Linux容器模式,并以VSCode进行编译。它像魔术一样工作。