【发布时间】:2019-09-01 22:11:20
【问题描述】:
为了对现有 ASP.NET Core 2.1 MVC 应用程序进行故障排除,我想使用 Docker 在同一台服务器上托管一个简单的 hello world ASP.NET Core MVC 应用程序。所以我创建了一个小的 Dockerfile:
FROM mcr.microsoft.com/dotnet/core/sdk:2.1 AS sdk-image
run dotnet new mvc
RUN dotnet publish -c Debug -o /publish
FROM mcr.microsoft.com/dotnet/core/aspnet:2.1 AS runtime-image
COPY --from=sdk-image /publish .
ENV ASPNETCORE_URLS=http://0.0.0.0:5000
ENV ASPNETCORE_ENVIRONMENT=Development
ENTRYPOINT ["dotnet", "WebApplication1.dll"]
但容器在恢复 NuGet 包时挂起:
Step 2/9 : RUN dotnet new mvc
---> Running in 54b50f10572b
Getting ready...
The template "ASP.NET Core Web App (Model-View-Controller)" was created successfully.
This template contains technologies from parties other than Microsoft, see https://aka.ms/aspnetcore-template-3pn-210 for details.
Processing post-creation actions...
Running 'dotnet restore' on /WebApplication1.csproj...
即使等待了几分钟,这些恢复也没有完成。 ASP.NET Core MVC 的默认模板只包含几个包。
【问题讨论】:
标签: c# docker asp.net-core docker-compose dockerfile