Docker Engine failed to start - Fix
Issue
Docker Desktop will not start after Install or an upgrade with an error Docker engine failed to start.
Docker Desktop version: 3.5.1 (66501)
Windows Version: Windows 10 20H2
Opening Docker Desktop will start with this state
After sometime it will get into this state
Error Details
The possible error screens and messages. Typically it comes as a pop-up when the Docker fails.
Docker.ApiServices.StateMachines.InvalidTransitionException:
Cannot stop from an unstable state at Docker.ApiServices.StateMachines.UnstableState.Docker.ApiServices.StateMachines.IInternalEngineState.BeginStopAsync() in C:\workspaces\PR-16070\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\UnstableState.cs:line 36
at Docker.ApiServices.StateMachines.EngineStateMachine.d__15.MoveNext() in C:\workspaces\PR-16070\src\github.com\docker\pinata\win\src\Docker.ApiServices\StateMachines\EngineStateMachine.cs:line 78
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Docker.Engines.Engines.d__26.MoveNext() in C:\workspaces\PR-16070\src\github.com\docker\pinata\win\src\Docker.Desktop\Engines\Engines.cs:line 264
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.************** Exception Text **************
System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at Docker.Core.Cmd.Run(String filename, String arguments) in C:\workspaces\PR-16070\src\github.com\docker\pinata\win\src\Docker.Core\Cmd.cs:line 36
at Docker.Backend.Processes.WindowsDockerDaemon.TryToStartService(Settings settings, String args, Dictionary2 env) in C:\workspaces\PR-16070\src\github.com\docker\pinata\win\src\Docker.Backend\Processes\WindowsDockerDaemon.cs:line 200 at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_1.<GetExecutor>b__0(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary
2 arguments, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ApiControllerActionInvoker.d__1.MoveNext()
Analysis
Tried following the steps to fix the issue
- Restart Docker Desktop that helps most of the time
- Windows reboot, welcome to the world of Microsoft
- Next uninstall, Reboot and Re-Install Docker Desktop (This cleared all the image cache)
None of the steps helped solving the issue. I started investigating the logs and the two windows services responsible for the docker to function properly. This could be verified by executing services.msc from windows run prompt.
I noticed the Docker Engine services missing and I picked up the service details from a working machine. I have listed for reference.
- "C:\Program Files\Docker\Docker\com.docker.service"
- "C:\P/r/ogram Files\Docker\Docker\resources\dockerd.exe" --run-service --service-name docker -G docker-users --config-file C:\ProgramData\DockerDesktop\tmp-d4w\daemon.json
Opened a powershell window and tried to execute the second service mentioned above and it threw an error the panic.log file access is denied.
I opened the log file and noticed similar access denied error.
Solution
Method 1
Open the following path in run prompt %ProgramData%/Docker and I renamed the panic.log file name to panic_old.log and tried opening the Docker desktop that will fix the issue.
Method 2
Do method one and try to execute the command in powershell and then open the Docker Desktop.
"C:\Program Files\Docker\Docker\resources\dockerd.exe" --run-service --service-name docker -G docker-users --config-file C:\ProgramData\DockerDesktop\tmp-d4w\daemon.json
Method 3
This issue is specific to version 3.6 where they fixed a vulnerability.
Remove the read only flag for the panic.log file in the following location %ProgramData%/Docker.
Ref:
https://nvd.nist.gov/vuln/detail/CVE-2021-37841
The issue might reappear after a system reboot. Delete the panic.log file and startup again. I will post if I find a permanant solution.
Update 9/7/2021:
Relase 4.0 has fixed the access issue.
Fixed a bug when switching from Linux to Windows containers due to access rights on panic.log
https://docs.docker.com/desktop/windows/release-notes/
Credits
Thanks for sharing their issue and possible fixes.
https://sitecorechat.slack.com/archives/C5VQ5SVKJ/p1629125020133400
https://twitter.com/longhorntaco
https://twitter.com/maartenwillebr1
https://twitter.com/techphoria414
https://stackoverflow.com/users/11822466/gskkc
Subscribe to Bala Blog | Sitecore MVP | Coveo MVP | DX MVP | Sitecore | Coveo | Microsoft
Get the latest posts delivered right to your inbox