在单个docker文件中,这些事情发生了:
第一阶段:使用SDK(aspnetcore-build)发布
第2阶段:运行时运行(aspnetcore)
但是运行时,出现此错误"Did you mean to run dotnet SDK commands? Please install dotnet SDK from:..."
显然"dotnet"
命令无法在“运行时”中识别。
这是我的docker文件
#Build Stage
FROM microsoft/aspnetcore-build:2 as build-env
WORKDIR /api
COPY . .
RUN dotnet restore
RUN dotnet publish -o /publish
#Runtime Image Stage
FROM microsoft/aspnetcore:2
WORKDIR /publish
COPY --from=build-env /publish .
ENTRYPOINT ["dotnet", "/api.dll"]
并使用docker build -t app:multi
使用docker run --rm -it app:multi
(这导致了错误)