简体   繁体   English

Dotnet core 2 docker:找不到匹配命令“dotnet-watch”的可执行文件

[英]Dotnet core 2 docker: No executable found matching command "dotnet-watch"

I'm trying to create a development Dockerfile for dotnet core 2. What I have so far is the following:我正在尝试为 dotnet core 2 创建一个开发Dockerfile 。到目前为止我所拥有的是以下内容:

FROM microsoft/aspnetcore-build:2.0

VOLUME /app
WORKDIR /app
COPY . ./
ENV ASPNETCORE_SERVER.URLS http://*:5000
ENV ASPNETCORE_ENVIRONMENT Development
RUN dotnet restore
ENTRYPOINT dotnet watch run --configuration Debug

If I run:如果我运行:

dotnet restore
dotnet watch run

From the same folder everything seems to work just fine (the watcher starts).在同一个文件夹中,一切似乎都很好(观察者启动)。 When I instead run that docker file (inside a docker-compose environment) it keeps shouting:当我运行该 docker 文件(在 docker-compose 环境中)时,它一直在喊:

No executable found matching command "dotnet-watch"找不到与命令“dotnet-watch”匹配的可执行文件

My configuration file is the following:我的配置文件如下:

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <Folder Include="wwwroot\" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.0.0" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" />
    <PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.0.0" />
  </ItemGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="2.0.0" />
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
  </ItemGroup>
</Project>

and as you can see contains the infamous:正如你所看到的,包含臭名昭著的:

<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="2.0.0" />

line that is usually what's causing the issue.这通常是导致问题的原因。

How can I make dotnet watch work on docker?如何让dotnet watch在 docker 上工作?

I just had to dotnet restore in the ENTRYPOINT like this:我只需要像这样在ENTRYPOINT dotnet restore

FROM microsoft/aspnetcore-build:2.0

VOLUME /app
WORKDIR /app
COPY . ./
ENV ASPNETCORE_SERVER.URLS http://*:5000
ENV ASPNETCORE_ENVIRONMENT Development
ENTRYPOINT dotnet restore && dotnet watch run --configuration Debug

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到与命令“ dotnet-./..dll”匹配的可执行文件 - No executable found matching command “dotnet-./..dll” 找不到与命令“ dotnet-install”匹配的可执行文件 - no executable found matching command “dotnet-install” 没有可执行文件在mac中找到匹配命令“dotnet-aspnet-codegenerator”asp.net core 2.1项目 - No executable found matching command “dotnet-aspnet-codegenerator” asp.net core 2.1 project in mac EF Core 1.1 Preview1:找不到与命令“ dotnet-ef”匹配的可执行文件 - EF Core 1.1 preview1: No executable found matching command “dotnet-ef” ASP.NET Core EF迁移错误:找不到与命令“ dotnet-ef”匹配的可执行文件 - ASP.NET Core EF Migration Error: No executable found matching command “dotnet-ef” ASP.NET核心RazorPages-找不到与命令“ dotnet-bundle”匹配的可执行文件 - ASP.NET core RazorPages - No executable found matching command “dotnet-bundle” ASP.NET MVC Core找不到匹配命令“dotnet-bundle”的可执行文件 - ASP.NET MVC Core No executable found matching command “dotnet-bundle” 如何解决错误:找不到与命令“ dotnet-install”匹配的可执行文件 - How to fix the error: No executable found matching command “dotnet-install” 找不到与命令dotnet-projectmodel-server匹配的可执行文件 - No executable found matching command dotnet-projectmodel-server dotnet ef数据库更新-找不到与命令“ dotnet-ef”匹配的可执行文件 - dotnet ef database update - No executable found matching command “dotnet-ef”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM