Docker 运行不会启动容器



我使用dotnet core 5创建了一个dotnet webapi服务,用下面的Dockerfile构建了一个docker映像,在运行它时得到下面的错误消息:

Could not execute because the application was not found or a compatible .NET SDK is not installed.
Possible reasons for this include:
* You intended to execute a .NET program:
The application 'PlatformService.dll' does not exist.
* You intended to execute a .NET SDK command:
It was not possible to find any installed .NET SDKs.
Install a .NET SDK from:
https://aka.ms/dotnet-download

DockerFile:

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env
WORKDIR /app
COPY *.csproj ./
RUN dotnet restore
COPY . ./
RUN dotnet publish -c Release -o out
FROM mcr.microsoft.com/dotnet/aspnet:5.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT [ "dotnet", "PlatformService.dll" ]

谁能指出这里到底缺少什么来运行我的图像?顺便说一句,我是在Windows 10机器上运行的。

如果您在Dockerfile中瞄准的DLL名称的大小写与磁盘上存在的文件的大小写不匹配(这仅适用于Linux),则会发生此错误。确保ENTRYPOINT [ "dotnet", "PlatformService.dll" ]使用与实际文件的大小写匹配的DLL名称。

最新更新