【发布时间】:2019-01-05 11:48:28
【问题描述】:
我正在为我的 Raspberry Pi 3 Model B+ 开发 Asp.Net Core 应用程序(带有 React 前端)。基于模板的应用(dotnet new react -o react-app)。
我想在我的 Windows 操作系统笔记本电脑上本地开发和调试应用程序,然后为 ARM32 架构构建应用程序,将映像推送到 docker hub 并在 Raspberry 设备上拉取并运行映像。
我发现,如果我在 Windows 笔记本电脑上使用 microsoft/dotnet:2.2-sdk 和 microsoft/dotnet:2.2-aspnetcore-runtime 构建应用程序,那么我无法在 Raspberry 设备上运行此映像并显示错误消息:' standard_init_linux.go:190: exec 用户进程导致“exec 格式错误”。看起来 Windows 构建的映像仅适用于 AMD64 架构。
然后我尝试将构建器和运行时映像更改为 ARM32,但现在构建过程崩溃并出现错误:
qemu: Unsupported syscall: 389
qemu: Unsupported syscall: 345 qemu:
uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault The command '/bin/sh -c dotnet restore' returned a
non-zero code: 139
我的 Docker 文件:
#FROM microsoft/dotnet:2.2-sdk AS builder
FROM microsoft/dotnet:2.2-sdk-stretch-arm32v7 AS builder
WORKDIR /source
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install -y nodejs
COPY *.csproj .
RUN dotnet restore
COPY ./ ./
RUN dotnet publish "./react-app.csproj" --output "./dist" --configuration Release --no-restore
#FROM microsoft/dotnet:2.2-aspnetcore-runtime
FROM microsoft/dotnet:2.2-aspnetcore-runtime-stretch-slim-arm32v7 as runtime
WORKDIR /app
COPY --from=builder /source/dist .
EXPOSE 80
ENTRYPOINT ["dotnet", "react-app.dll"]
是否可以从 Windows 操作系统为 Raspberry 设备构建映像?
如果是,您能帮我解决一下 Docker 设置吗?
【问题讨论】:
标签: docker .net-core raspberry-pi react-redux