如何使用Docker创建ASP.Net Core 2.1应用程序映像?

时间:2018-10-30 15:04:52

标签: docker asp.net-core asp.net-core-mvc dotnet-restore

我已经使用为VS2017提供的模板创建了一个基本的.Net Core MVC应用程序。

我正在将Docker用于Windows,这就是我的Docker文件的外观。

FROM microsoft/dotnet:2.1-aspnetcore-runtime-nanoserver-sac2016 AS build-env
WORKDIR /app

# Copy csproj and restore as distinct layers
COPY *.csproj ./app
RUN dotnet restore

# Copy everything else and build
COPY . ./
RUN dotnet publish -c Release -o out

# Build runtime image
FROM microsoft/dotnet:aspnetcore-runtime
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "aspwebdocker.dll"]

&我尝试使用VS创建的默认Dockerfile

FROM microsoft/dotnet:2.1-aspnetcore-runtime-nanoserver-sac2016 AS base
WORKDIR /app
EXPOSE 80

FROM microsoft/dotnet:2.1-sdk-nanoserver-sac2016 AS build
WORKDIR /src
COPY ["aspnetcoredocker/aspnetcoredocker.csproj", "aspnetcoredocker/"]
RUN dotnet restore "aspnetcoredocker/aspnetcoredocker.csproj"
COPY . .
WORKDIR "/src/aspnetcoredocker"
RUN dotnet build "aspnetcoredocker.csproj" -c Release -o /app

FROM build AS publish
RUN dotnet publish "aspnetcoredocker.csproj" -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "aspnetcoredocker.dll"]

但是在两个docker文件中,docker build -t aspnetcore命令都被吊起无限跨度,

enter image description here

如何确定缺少的配置?

0 个答案:

没有答案