在尝试使用this文章部署我的ASP.Net Core 2.1应用时,我遇到了问题。
Sending build context to Docker daemon 25.18MB
Step 1/10 : FROM microsoft/dotnet:2.1-aspnetcore-runtime AS build-env
---> 625b44243fbe
Step 2/10 : WORKDIR /app
---> Using cache
---> a8c5d2ab76c0
Step 3/10 : COPY *.csproj ./
---> Using cache
---> c2c11e2b4699
Step 4/10 : RUN dotnet restore
---> Running in 4ae02c24aabc
[91mDid you mean to run dotnet SDK commands? Please install dotnet SDK from:
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
docker : The command '/bin/sh -c dotnet restore' returned a non-zero code: 145
At D:\Projects\Ozon\solutionName\projectname\deploy.ps1:3 char:1
+ docker build -t projectname .
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (The command '/b...-zero code: 145:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
我正在运行部署脚本来对我的应用进行dockerize。
docker build -t projectname .
docker run -d -p 8080:80 --name api projectname
有我的DOCKERFILE
FROM microsoft/dotnet:2.1-aspnetcore-runtime AS build-env
WORKDIR /app
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM microsoft/dotnet:2.1-aspnetcore-runtime
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "projectname.dll"]
我做错了什么?任何建议将不胜感激。
答案 0 :(得分:0)
您正在使用microsoft/dotnet:2.1-aspnetcore-runtime
代替microsoft/dotnet:2.1-sdk
。更改基本图像。