Search code examples
docker.net-coredocker-composedockerfiledocker-for-windows

How to resolve Error response from docker daemon - executable file not found in $PATH: unknown


After successfully build docker Image using command docker build . -t HellowWorld-netcore

I got bellow Error at the time of run docker using command docker run -d -p 8082:8082 HelloWorld-netcore

docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: exec: "dotnet": executable file not found in $PATH: unknown.

Dockerfile content

FROM mcr.microsoft.com/dotnet/runtime-deps:3.1
COPY src .
EXPOSE 8082
CMD ["dotnet", "./HelloWorld.dll"]

Under src file all the supportive dll, HellowWorld.dll & HellowWorld.exe file exists. src folder & Dockerfile is in the same root


Solution

  • made some changes in Dockerfile and the program run as expected

    Code Snippet

    FROM mcr.microsoft.com/dotnet/core/sdk:3.1 
    RUN mkdir app
    
    COPY ./src/* /app/
    WORKDIR /app
    EXPOSE 8082
    ENTRYPOINT ["dotnet", "HelloWorld.dll"]
    

    Note: It seems to me problem is in .Net Framework. Downloading correct SDK, program running perfectly. And able to get the output from browser as well using (http://localhost:8082/HellowWorld).