0

I am trying to create an Azure IoT Edge device on a Windows host, but running a module built as a Linux container. In a previous experiment, I was able to successfully create an Azure IoT Edge device on a Linux host, and successfully running this same Linux container module.

However, when I deploy the module onto the Windows host, the module shows that it is not running, and when I view the module's log using "iotedge logs camera-capture" I get the following error:

<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

I have found no results online, or through Microsoft forums, regarding this particular error that was able to resolve my problem. For the record, I have ensured:

  • I am running a compatible Windows 10 host (17763)
  • I have Hyper-V and Containers installed
  • I have VT enabled in the BIOS
  • I have configured my deployment.template.json to build as "amd64" platform
  • I have configured my Docker Desktop to run using Linux Containers (and also enabled Experimental mode)
  • I have tested the basic "hello-world" ubuntu example online, and it works when I run it from Powershell, which proves that a Linux container will run on my Windows host

Any help would be greatly appreciated!

Tam Bui
  • 2,940
  • 2
  • 18
  • 27

2 Answers2

0

After spending a few days stuck on this issue, I finally found the solution. The problem was with the IoT Edge runtimes on Windows were not configured to handle Linux containers! As of this writing, the solution is documented here by Microsoft: https://learn.microsoft.com/en-us/azure/iot-edge/how-to-install-iot-edge-windows-with-linux

But in case of a future dead link, you basically have to add additional flags when you install your Azure IoT Edge runtimes to handle linux containers.

. {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
Tam Bui
  • 2,940
  • 2
  • 18
  • 27
  • 2
    It's important to know that's this usage is not recommanded by Microsoft for production. ```In a production scenario, Windows devices should only run Windows containers.``` This might change when the new Docker Desktop version with WSL enabled will be available though. – Zied Dec 09 '19 at 15:57
  • @Zied agreed. This was done for experimentation purposes at this time, and not production. – Tam Bui Dec 10 '19 at 16:45
0

I changed Docker Desktop to Linux container mode and compiled in VSCode. It worked like magic.

vkb_2009
  • 11
  • 2