.NET Core in Docker:"No executable found matching command "dotnet-"
When building docker images for Windows and Linux, which host .NET Core applications you might run into some issues, which looks like:
*No executable found matching command "dotnet-..."*
You might wonder that your container is running on Windows OS perfectly, but when switching to Linux OS, the application fails. This is exactly what happened to me over and over again. Here is the dockerfile, which I have used:
FROM microsoft/dotnet
ARG EXE_DIR=.
WORKDIR /app
COPY $EXE_DIR/ ./
ENTRYPOINT ["dotnet", "./cosmosperftests.dll"]
The issue here is neither Docker nor .NET Core. It is OS behavior. This container will run on Windows, but in my case it will not run on Linux. It seems that dotnet is not installed. However, I have changed dockerfile and run it interactively. I was surprised that dotnet was correctly installed and I could run application directly from container.
The problem here is simply casing of assembly. The real name of DLL is CosmosPerfTests.dll and not cosmosperftests.dll.
Unfortunately, the CLI, misunderstood the cause of the issue and tried some probing to find assembly. This is why the error was pointing on some bigger issue than it is.
ENTRYPOINT ["dotnet", "./CosmosPerfTests.dll"]