visual-studio - Angular 项目未在 docker 上使用 Visual Studio 2019 运行

标签 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 支持(右键单击项目名称 -> 添加 -> Docker 支持)。

enter image description here

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

enter image description here

enter image description here

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

enter image description here

最佳答案

对于这个错误,是由node引起的未安装在 mcr.microsoft.com/dotnet/core/aspnet:3.0-stretch-slim图像,尝试更改您的 dockerfile 以安装 node使用版本 10 或更高版本。

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

关于visual-studio - Angular 项目未在 docker 上使用 Visual Studio 2019 运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56044251/

相关文章:

docker - Dockerfile找不到复制的文件夹

docker - npm install 在 Docker 中不起作用

c# - 分析路由时动态添加Asp .NET Core Controller

用于 Visual Studio 内联图形的 Python 工具

c++ - Visual Studio 可以在 C++ 头文件中为我管理函数原型(prototype)吗?

c# - 如何获取 ENVDTE CodeInterface 的通用类型参数?

visual-studio - 如何指定 T4 文件是否应产生任何输出

visual-studio - 是否可以在 Windows 容器中安装 Visual Studio

c# - 在 ASP.NET Core 3 的类库中创建 TagHelper

sql-server - LINQ 查询返回列表,其中条件基于另一个表