找不到asp.net核心docker linux程序集

时间:2019-05-15 03:29:54

标签: docker asp.net-core

将asp.net core 2.2应用程序部署到Linux上的docker时,运行dotnet someprogram.dll时,它会抱怨找不到依赖项dll。但是显然该dll与someprogram.dll位于同一文件夹中,该消息专门抱怨缺少'lib / dotnetstandard2.0 / someassembly.dll'中的程序集。这是为什么? dll应该在哪里?

这是Dockerfile

FROM microsoft/dotnet:2.2-sdk AS build 
WORKDIR /app 
COPY . . 
WORKDIR /app/WebService 
RUN dotnet build -c Release -o /app/out 

FROM build AS publish 
RUN dotnet publish -c Release -o /app/out 

FROM microsoft/dotnet:2.2-aspnetcore-runtime 
WORKDIR /app 
COPY --from=build /app/out . ENTRYPOINT ["dotnet", "WebService.dll"]

1 个答案:

答案 0 :(得分:0)

证明此行引起了麻烦。

FROM build AS publish

将其注释掉后,该应用程序开始运行。

这里是Dockerfile

FROM microsoft/dotnet:2.2-sdk AS build 
WORKDIR /app 

COPY . . 

WORKDIR /app/WebService 
RUN dotnet publish -c Release -o /app/out 

FROM microsoft/dotnet:2.2-aspnetcore-runtime 
WORKDIR /app 
COPY --from=build /app/out . 

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