Azure物联网边缘:解决方案无法在VSCode中构建和推送arm32v7平台

时间:2020-06-17 19:35:41

标签: docker iot azure-iot-edge azure-container-registry

我使用IoT工具在VScode中创建了一个现成的模板c#边缘解决方案,但是在尝试构建和推送该解决方案时遇到以下错误:

Step 4/12 : RUN dotnet restore
---> Running in 22c6f8ceb80c
A fatal error occurred, the folder [/usr/share/dotnet/host/fxr] does not contain any version-numbered child folders
The command '/bin/sh -c dotnet restore' returned a non-zero code: 131

当它试图通过Dockerfile.arm32v7中的命令运行时,显然发生了这种情况:

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster-arm32v7 AS build-env
WORKDIR /app

COPY *.csproj ./
RUN dotnet restore

COPY . ./
RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/core/runtime:3.1-buster-slim-arm32v7
WORKDIR /app
COPY --from=build-env /app/out ./

RUN useradd -ms /bin/bash moduleuser
USER moduleuser

ENTRYPOINT ["dotnet", "SampleModule.dll"]

这仅在为arm32v7构建时发生,但对amd64有效。我要在树莓派上使用建筑,所以我需要arm32。

在我看来,我的环境可能有问题,但不确定在哪里看? 我还看到了一些注释,如果您希望它可以工作,则需要在ARM主机上进行构建,但是我以前从未在文档中看到过,并且从易于开发的角度来看也是没有意义的

1 个答案:

答案 0 :(得分:0)

使用az acr build提交构建时,可以传入参数--platform linux/arm/v7,该参数应为您提供ARM构建环境。

如果您希望在本地构建,则可以尝试在Dockerfile的第一阶段使用pulling the qemu package into the build context