为 Windows 台设备开发 IoT Edge 模块教程构建错误

Develop IoT Edge modules for Windows devices Tutorial Build Error

我已经完成了教程中的所有步骤Tutorial: Develop IoT Edge modules for Windows devices

我已经登录 docker 桌面。

然而,当我尝试构建和发布时,我在输出中收到以下错误 window

> DOCKER_HOST: 
DOCKER_TLS_VERIFY: 
DOCKER_CERT_PATH: 
Additional Env Variables: 
------ Build and Push IoT Edge Modules started: Platform: Windows Amd64, Configuration: Release ------
The deployment manifest is generated at C:\Users\bar\source\repos\AzureIotEdgeApp3\config\deployment.windows-amd64.json
docker build --rm -f "C:\Users\bar\source\repos\IotEdgeModule3\Dockerfile.windows-amd64" -t FOO.azurecr.io/iotedgemodule3:0.0.1-windows-amd64  "C:\Users\bar\source\repos\IotEdgeModule3"
#2 (internal) load .dockerignore
#2 transferring context: 2B done
#2 DONE 0.1s
#1 (internal) load build definition from Dockerfile.windows-amd64
#1 transferring dockerfile: 46B 0.0s done
#1 DONE 0.1s
#3 (internal) load metadata for mcr.microsoft.com/dotnet/core/runtime:3.1-n...
#3 DONE 0.0s
#4 (internal) load metadata for mcr.microsoft.com/dotnet/core/sdk:3.1-nanos...
#4 DONE 0.0s
#5 (stage-1 1/3) FROM mcr.microsoft.com/dotnet/core/runtime:3.1-nanoserver-...
#5 CACHED
#9 (internal) load build context
#9 transferring context: 1.20kB 0.0s done
#9 DONE 0.2s
#6 (stage-1 2/3) WORKDIR /app
#6 ERROR: open /var/lib/docker/overlay2/78d2cb8633edf0eef3af53faff16f4b1570ca332555085bcadcb185c037611dd/merged/etc/passwd: no such file or directory
#7 (build-env 1/6) FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-18...
#7 resolve mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1809@sha256:aeab6d06ece872b88e59c4da0a98aa64e637aa979a161923658c5f7ef74b9699 done
#7 sha256:918abb37d3f2ac5ee5f9ad3d2017bebcdc353838e7097f5be7fda8c7df590489 4.36kB / 4.36kB done
#7 sha256:aeab6d06ece872b88e59c4da0a98aa64e637aa979a161923658c5f7ef74b9699 3.43kB / 3.43kB done
#7 CANCELED

 > (stage-1 2/3) WORKDIR /app:

failed to solve with frontend dockerfile.v0: failed to build LLB: open /var/lib/docker/overlay2/78d2cb8633edf0eef3af53faff16f4b1570ca332555085bcadcb185c037611dd/merged/etc/passwd: no such file or directory
(ERROR): Build docker image failed: #2 (internal) load .dockerignore
#2 transferring context: 2B done
#2 DONE 0.1s
#1 (internal) load build definition from Dockerfile.windows-amd64
#1 transferring dockerfile: 46B 0.0s done
#1 DONE 0.1s
#3 (internal) load metadata for mcr.microsoft.com/dotnet/core/runtime:3.1-n...
#3 DONE 0.0s
#4 (internal) load metadata for mcr.microsoft.com/dotnet/core/sdk:3.1-nanos...
#4 DONE 0.0s
#5 (stage-1 1/3) FROM mcr.microsoft.com/dotnet/core/runtime:3.1-nanoserver-...
#5 CACHED
#9 (internal) load build context
#9 transferring context: 1.20kB 0.0s done
#9 DONE 0.2s
#6 (stage-1 2/3) WORKDIR /app
#6 ERROR: open /var/lib/docker/overlay2/78d2cb8633edf0eef3af53faff16f4b1570ca332555085bcadcb185c037611dd/merged/etc/passwd: no such file or directory
#7 (build-env 1/6) FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-18...
#7 resolve mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1809@sha256:aeab6d06ece872b88e59c4da0a98aa64e637aa979a161923658c5f7ef74b9699 done
#7 sha256:918abb37d3f2ac5ee5f9ad3d2017bebcdc353838e7097f5be7fda8c7df590489 4.36kB / 4.36kB done
#7 sha256:aeab6d06ece872b88e59c4da0a98aa64e637aa979a161923658c5f7ef74b9699 3.43kB / 3.43kB done
#7 CANCELED

 > (stage-1 2/3) WORKDIR /app:

failed to solve with frontend dockerfile.v0: failed to build LLB: open /var/lib/docker/overlay2/78d2cb8633edf0eef3af53faff16f4b1570ca332555085bcadcb185c037611dd/merged/etc/passwd: no such file or directory

我正在 Windows 10 Pro、x64 计算机上尝试此操作,该计算机安装了 Visual studio 版本 16.8.0 和 Docker Windows 桌面(稳定版)的最新版本昨天

我已经尝试重新安装 docker 并创建 visual studio 项目,但我仍然遇到同样的错误。

这是 docker 文件 Dockerfile.windows-amd64:

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-nanoserver-1809 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-nanoserver-1809
WORKDIR /app
COPY --from=build-env /app/out ./
ENTRYPOINT ["dotnet", "IotEdgeModule3.dll"]

Kgalic 是正确的,我 Docker 默认使用 Linux 运行。我通过使用系统尝试中 docker 图标上的上下文菜单切换到 Windows。