Raeglyn
Raeglyn

Reputation: 125

Docker run error: “Could not execute because the specified command or file was not found”

I am using docker to build and run two services, one a .net core website and the other a .net core processor. I have the website up and running just fine. When I try to run my processor however, I get the following error message:

Could not execute because the specified command or file was not found. Possible reasons for this include:

  • You misspelled a built-in dotnet command.

  • You intended to execute a .NET Core program, but dotnet-chores.processor.dll does not exist.

  • You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.

My processer dockerfile:

FROM mcr.microsoft.com/dotnet/core/sdk:3.0.100 AS build
COPY /src /all/src

WORKDIR /all/src
RUN dotnet build -c Release -o /app
RUN dotnet publish --no-restore -c Release -o /app

# FROM mcr.microsoft.com/dotnet/core/aspnet:3.0
WORKDIR /app
# COPY --from=build /app .
EXPOSE 80
ENTRYPOINT ["dotnet", "chores.processor.dll"]

Processor csproj:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>netcoreapp3.0</TargetFramework>
        <RootNamespace>Chores.Processor</RootNamespace>
    </PropertyGroup>
    <ItemGroup>
        <PackageReference Include="Dapper" Version="2.0.30" />
        <PackageReference Include="MySqlConnector" Version="0.59.2" />
    </ItemGroup>
</Project>

Website csproj:

<Project Sdk="Microsoft.NET.Sdk.Web">
    <PropertyGroup>
        <TargetFramework>netcoreapp3.0</TargetFramework>
    </PropertyGroup>
    <ItemGroup>
        <PackageReference Include="Dapper" Version="2.0.30" />
        <PackageReference Include="MySqlConnector" Version="0.59.2" />
    </ItemGroup>
</Project>

It seems odd to me that the error message appears to be looking for dotnet-chores.processor.dll; why is it prefixed with “dotnet-”?

If anyone has any suggestions on what I can do to further debug this, I would appreciate it.

Upvotes: 3

Views: 9862

Answers (1)

aleksander_si
aleksander_si

Reputation: 1357

The chores.processor.dll can't be found because the correct name is Chores.Processor.dll - Linux is case sensitive. So:

ENTRYPOINT ["dotnet", "Chores.Processor.dll"]

or

CMD dotnet ./Chores.Processor.dll

The error message is misleading in the sense that it adds a dash.

Upvotes: 5

Related Questions