Angular Project无法在Visual Studio 2019的Docker上运行

时间:2019-05-08 15:32:04

标签: visual-studio docker asp.net-core visual-studio-2019

我使用内置的Angular模板(ASP.NET Core 3)在Visual Studio 2019上创建了一个新的Web项目。

enter image description here

然后,我使用Visual Studio的向导添加了docker支持(右键单击项目名称-> Add-> Docker Support)。

enter image description here

当我使用IIS Express从Visual Studio启动项目时,项目运行正常,但使用Docker启动项目时出现以下错误:

enter image description here

enter image description here

我认为docker文件中缺少某些内容。这是我的内容:

enter image description here

1 个答案:

答案 0 :(得分:0)

对于此错误,原因是在node映像中未安装mcr.microsoft.com/dotnet/core/aspnet:3.0-stretch-slim,请尝试将dockerfile更改为安装版本10或更高版本的node

FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-stretch-slim AS base
# BEGIN MODIFICATION - Node is needed for development (but not production)
RUN curl -sL https://deb.nodesource.com/setup_10.x | bash -
RUN apt-get install --assume-yes nodejs
# END MODIFICATION

WORKDIR /app
EXPOSE 80
EXPOSE 443