Reputation: 333
I am very new to docker. And I am trying to dockerize a helloworld API. But when I tried to docker run the image, I got this error:
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: container f891d7fc7af6e1183256043e6105fc87e25c6959d9745cc972b42c7b2e6f5a06 encountered an error during CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2) [Event Detail: Provider: 00000000-0000-0000-0000-000000000000] [Event Detail: Provider: 00000000-0000-0000-0000-000000000000] [Event Detail: vm\compute\management\orchestration\vmhostedcontainer\processmanagement.cpp(168)\vmcomputeagent.exe!00007FF683797B25: (caller: 00007FF68377A312) Exception(4) tid(108) 80070002 The system cannot find the file specified. CallContext:[\Bridge_ProcessMessage\ComputeSystemManager_ExecuteProcess\VmHostedContainer_ExecuteProcess] Provider: 00000000-0000-0000-0000-000000000000] extra info: {"CommandLine":"dotnet HelloWorldDocker.dll","WorkingDirectory":"C:\app\bin","Environment":{"COMPLUS_NGenProtectedProcess_FeatureEnabled":"0","ROSLYN_COMPILER_LOCATION":"c:\\RoslynCompilers\\tools"},"CreateStdInPipe":true,"CreateStdOutPipe":true,"CreateStdErrPipe":true,"ConsoleSize":[0,0]}.
I have a simple asp.net api. And I have it published to the same folder ./publish
And here is my docker file
FROM microsoft/aspnet:4.7.1-windowsservercore-1709
WORKDIR /app
COPY ./publish .
WORKDIR bin
RUN ls
ENTRYPOINT ["dotnet", "HelloWorldDocker.dll"]
ls
shows that the HelloWorldDocker.dll
is in the directory ./bin (app/bin)
. IDK what is wrong here...
Upvotes: 15
Views: 21468
Reputation: 1576
In the runner config.toml
, my runner was configured to use the shell pwsh
.
I replaced it with powershell
and it worked.
The error comes from the fact that, for whatever reason, pwsh
is not available.
Upvotes: 3
Reputation: 414
In my case, I was with this error (little similar):
Command: docker run -it henriqueholtz/node-win:16.15.1 cmd
docker: Error response from daemon: container 1edc7d95388e28604239457fd47ced188b968ab825f8da400c8bea84cfbb7ceb encountered an error during hcsshim::System::CreateProcess: failure in a Windows system call: The system cannot find the file specified. (0x2)
[Event Detail: Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: Provider: 00000000-0000-0000-0000-000000000000]
[Event Detail: onecore\vm\compute\management\orchestration\vmhostedcontainer\processmanagement.cpp(174)\vmcomputeagent.exe!00007FF744D6C00A: (caller: 00007FF744D3ECEA) Exception(2) tid(368) 80070002 The system cannot find the file specified.
CallContext:[\Bridge_ProcessMessage\ComputeSystemManager_ExecuteProcess\VmHostedContainer_ExecuteProcess]
Provider: 00000000-0000-0000-0000-000000000000].
After some hours trying with no success, I've removed all similar images, pulled the image again (in my case from docker hub), and then it worked.
Upvotes: 0
Reputation: 329
this may happen when you are rebuilding the image , in fact when you build a docker image it creates some intermediate containers and images so by deleting these containers and images from the previous build fail it worked for me.
Upvotes: 2
Reputation: 237
This line COPY ./publish .
will copy all publish files into your current work directory. The bin folder that contains your DLL now lives here: /app/bin/{your dll}
.
It is not necessary to then change the work dir to bin like you did; instead, you could either leave your work dir alone (stay in /app) and specify your entrypoint as:
ENTRYPOINT ["dotnet", "./bin/HelloWorldDocker.dll"]
-OR-
You could set your WORKDIR to /app/bin
and specify your entrypoint as you already did: ENTRYPOINT ["dotnet", "HelloWorldDocker.dll"]
The main thing you need to keep in mind is where the files are in relation to your workdir, which you can manage by changing your workdir as well as copying files, as you did by copying all publish files into /app
Upvotes: 2