question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Build of IoT Edge Solution failing on Mac OS X with VS Code

See original GitHub issue

Hi,

I have created sample IoT Edge solution using C# module and able to build solution if select amd64 for linux or arm32v7.

This complete setup is on Mac OS X- 10.14.3

Below is the log for successful build-

docker build  --rm -f "/Users/singh.prateek/Documents/usb_edge_module/samplesolution/modules/SampleModule/Dockerfile.amd64" -t localhost:5000/samplemodule:0.0.1-amd64 "/Users/singh.prateek/Documents/usb_edge_module/samplesolution/modules/SampleModule"
nvm is not compatible with the npm config "prefix" option: currently set to "/usr/local"
Run `npm config delete prefix` or `nvm use --delete-prefix v8.1.3 --silent` to unset it.
AMAC02T82A5G8WL:samplesolution singh.prateek$ docker build  --rm -f "/Users/singh.prateek/Documents/usb_edge_module/samplesolution/modules/SampleModule/Dockerfile.amd64" -t localhost:5000/samplemodule:0.0.1-amd64 "/Users/singh.prateek/Documents/usb_edge_module/samplesolution/modules/SampleModule"
Sending build context to Docker daemon  499.2kB
Step 1/12 : FROM microsoft/dotnet:2.1-sdk AS build-env
 ---> d14ca4022ef8
Step 2/12 : WORKDIR /app
 ---> Using cache
 ---> eb579a436ee1
Step 3/12 : COPY *.csproj ./
 ---> Using cache
 ---> 6545fdce6700
Step 4/12 : RUN dotnet restore
 ---> Using cache
 ---> 4c9957eecd3f
Step 5/12 : COPY . ./
 ---> Using cache
 ---> a6a8fe4644df
Step 6/12 : RUN dotnet publish -c Release -o out
 ---> Using cache
 ---> 1e6cc7003801
Step 7/12 : FROM microsoft/dotnet:2.1-runtime-stretch-slim
 ---> e1979bed16c6
Step 8/12 : WORKDIR /app
 ---> Using cache
 ---> 8b1e6764a5cc
Step 9/12 : COPY --from=build-env /app/out ./
 ---> Using cache
 ---> f0d0e8fdbccc
Step 10/12 : RUN useradd -ms /bin/bash moduleuser
 ---> Using cache
 ---> 81b8f8005ba8
Step 11/12 : USER moduleuser
 ---> Using cache
 ---> 1436a3d62862
Step 12/12 : ENTRYPOINT ["dotnet", "SampleModule.dll"]
 ---> Using cache
 ---> 76b283d4b4f3
Successfully built 76b283d4b4f3
Successfully tagged localhost:5000/samplemodule:0.0.1-amd64

Selected amd64 in status bar in bottom. Below is the screenshot-

Screenshot 2019-04-12 at 00 22 42

I need to build a solution on Windows IoT Core but facing issue while building the code. If i select to build the solution for windows.amd64. It get failed and build doesn’t get completed.
Facing the same issue on Windows 10 Enterprise with VS Code. Below is the log for the same-

docker run -d -p 5000:5000 --restart always --name registry registry:2 docker build --rm -f “/Users/singh.prateek/Documents/usb_edge_module/samplesolution/modules/SampleModule/Dockerfile.windows-amd64” -t localhost:5000/samplemodule:0.0.1-windows-amd64 “/Users/singh.prateek/Documents/usb_edge_module/samplesolution/modules/SampleModule” nvm is not compatible with the npm config “prefix” option: currently set to “/usr/local” Run npm config delete prefix or nvm use --delete-prefix v8.1.3 --silent to unset it. AMAC02T82A5G8WL:samplesolution singh.prateek$ docker run -d -p 5000:5000 --restart always --name registry registry:2 Unable to find image ‘registry:2’ locally 2: Pulling from library/registry c87736221ed0: Pull complete 1cc8e0bb44df: Pull complete 54d33bcb37f5: Pull complete e8afc091c171: Pull complete b4541f6d3db6: Pull complete Digest: sha256:3b00e5438ebd8835bcfa7bf5246445a6b57b9a50473e89c02ecc8e575be3ebb5 Status: Downloaded newer image for registry:2 5f1cbd7626cd41e7323b9fc863a373eff286b1a2202454c5aaa9f24b752fe302 AMAC02T82A5G8WL:samplesolution singh.prateek$ docker build --rm -f “/Users/singh.prateek/Documents/usb_edge_module/samplesolution/modules/SampleModule/Dockerfile.windows-amd64” -t localhost:5000/samplemodule:0.0.1-windows-amd64 “/Users/singh.prateek/Documents/usb_edge_module/samplesolution/modules/SampleModule” Sending build context to Docker daemon 499.2kB Step 1/10 : FROM microsoft/dotnet:2.1-sdk AS build-env —> d14ca4022ef8 Step 2/10 : WORKDIR /app —> Using cache —> eb579a436ee1 Step 3/10 : COPY *.csproj ./ —> Using cache —> 6545fdce6700 Step 4/10 : RUN dotnet restore —> Using cache —> 4c9957eecd3f Step 5/10 : COPY . ./ —> a6a8fe4644df Step 6/10 : RUN dotnet publish -c Release -o out —> Running in ac36c998ccba Microsoft ® Build Engine version 15.8.166+gd4e8d81a88 for .NET Core Copyright © Microsoft Corporation. All rights reserved.

Restoring packages for /app/SampleModule.csproj… Installing WindowsAzure.Storage 9.3.2. Installing Microsoft.Azure.Amqp 2.4.1. Installing Microsoft.Azure.Devices.Shared 1.16.0. Installing Microsoft.Azure.Devices.Client 1.20.0. Generating MSBuild file /app/obj/SampleModule.csproj.nuget.g.props. Generating MSBuild file /app/obj/SampleModule.csproj.nuget.g.targets. Restore completed in 4.28 sec for /app/SampleModule.csproj. SampleModule -> /app/bin/Release/netcoreapp2.1/SampleModule.dll SampleModule -> /app/out/ Removing intermediate container ac36c998ccba —> 1e6cc7003801 Step 7/10 : FROM microsoft/dotnet:2.1-runtime-nanoserver-1809 2.1-runtime-nanoserver-1809: Pulling from microsoft/dotnet 9319e23c8670: Pulling fs layer 06115200a5ea: Pulling fs layer bfe004a217a3: Downloading [==============================> ] 501B/832B 62910792b602: Waiting 3438d488c839: Waiting a6068294d62b: Waiting image operating system “windows” cannot be used on this platform

Below is the screenshot for windows.amd64 selection in status bar-

Screenshot 2019-04-12 at 00 21 49

Can you please let me know the root cause for this. I tried the same

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
shizncommented, Apr 15, 2019

@pratson20 If you want to work on MacOS and build Windows containers, there are two options.

  1. Use VS Code on MacOS, then configure the Docker Host and point to your IoT Core device. Please see here - https://devblogs.microsoft.com/iotdev/easily-build-and-debug-iot-edge-modules-on-your-remote-device-with-azure-iot-edge-for-vs-code-1-9-0/
  2. Switch to Windows dev machine.
0reactions
veyallacommented, Apr 25, 2019

I don’t think the Windows VM in Mac OS can support Hyper-V as this is a nested virtualization configuration.

You can try using the --isolation=process switch (link)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to 'Build and Run IoT Edge Simulator' in Visual ...
Have been trying to build and run a custom Azure IoT Edge Module, in VS Code, on macOS. When I try to Build...
Read more >
Troubleshoot Azure IoT Edge common errors
Use this article to identify and resolve common issues when using IoT Edge solutions. If you need information on how to find logs...
Read more >
Develop IoT Edge modules using Visual Studio Code
This tutorial walks through setting up your development machine and cloud resources to develop IoT Edge modules.
Read more >
Azure IoT Edge for Visual Studio Code
Azure IoT Edge extension makes it easy to code, build, deploy, and debug your IoT ... Access is denied when debugging C# module...
Read more >
Azure IoT Edge
Azure IoT Edge is a fully managed service to deploy Cloud workloads to run on Internet of Things (IoT) Edge devices using standard...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found