我想将Asp.Net Core 2.1应用程序部署到Raspberry Pi 3中。
这是场景: 我在VS 2017中将其开发为Docker包装的应用程序
Raspberry Pi正在安装docker的情况下运行Raspbian。 该应用程序在开发机器上运行良好,但是当我将映像部署到Raspberry并尝试在其中运行时,出现了错误:
standard_init_linux.go:190: exec user process caused "exec format error"
我认为发生这种情况是因为我的映像的体系结构错误(intel而不是arm),但是我不知道该如何解决。请告知。
这是我的docker文件:
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
WORKDIR /app
EXPOSE 80
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY ["WebApplication4/WebApplication4.csproj", "WebApplication4/"]
RUN dotnet restore "WebApplication4/WebApplication4.csproj"
COPY . .
WORKDIR "/src/WebApplication4"
RUN dotnet build "WebApplication4.csproj" -c Release -o /app
FROM build AS publish
RUN dotnet publish "WebApplication4.csproj" -c Release -o /app
FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "WebApplication4.dll"]
答案 0 :(得分:0)
您尝试过吗?
# This Dockerfile uses nightly preview builds for .NET Core
# It will be updated to .NET Core 2.2 shortly
FROM microsoft/dotnet-nightly:2.1-sdk AS build
WORKDIR /app
# copy csproj and restore as distinct layers
COPY *.sln .
COPY aspnetapp/*.csproj ./aspnetapp/
RUN dotnet restore
# copy everything else and build app
COPY aspnetapp/. ./aspnetapp/
WORKDIR /app/aspnetapp
RUN dotnet publish -c Release -o out
FROM microsoft/dotnet-nightly:2.1-aspnetcore-runtime AS runtime
WORKDIR /app
COPY --from=build /app/aspnetapp/out ./
ENTRYPOINT ["dotnet", "aspnetapp.dll"]
在官方dockerhub中建议这样做。还有一些用arm32标签的图像。