Docker构建映像失败-没有此类文件或目录

时间:2020-06-19 00:26:54

标签: .net linux docker dockerfile containers

我在Visual Sutdio 2019中创建了一个.Net Core应用程序并添加了docker支持,因此它会自动生成文件,但是当我构建docker映像时,输出显示:

class DriverType(DjangoObjectType):
    class Meta:
        model = Driver

class UserType(DjangoObjectType):
    class Meta:
        model = User

class Query(object):
    all_drivers = graphene.List(DriverType)
    all_users = graphene.List(UserType)

    def resolve_all_drivers(self, info, **kwargs):
        return Driver.objects.all()

    def resolve_all_users(self, info, **kwargs):
        return Users.objects.all()

我认为COPY存在问题,但不确定。

这是我的docker文件:

1>/root/.nuget/packages/microsoft.typescript.msbuild/3.9.5/tools/Microsoft.TypeScript.targets(551,5): 
error MSB6003: The specified task executable "node" could not be run. System.ComponentModel.Win32Exception 
(2): No such file or directory [/src/CyberEvalNextGen.csproj]

1 个答案:

答案 0 :(得分:2)

我有同样的问题。该错误有点令人误解,因为它的末尾列出了您的.csproj,但这是关键部分:

The specified task executable "node" could not be run.

它实际上正在寻找运行命令“ node”,但找不到可执行文件。为了解决这个问题,我在构建步骤之前添加了Node.js。

...
WORKDIR "/src/."
#Installing Node.js in build container
RUN apt-get update && apt-get -y install nodejs                   
RUN dotnet build "CyberEvalNextGen.csproj" -c Release -o /app/build
...

这使用的是Linux容器,但是我相信您可以在Windows容器中使用PowerShell进行类似的操作。