Scenario:
You have installed Docker Desktop on Windows 10. Starting Docker daemon for Linux Container works fine. But you want to Switch for Windows Container. You right click on Docker icon in taskbar tray and click “Switch to Windows Containers”. It starts the process of switching but after few minutes, error is shown as below-
System.ServiceProcess.TimeoutException:
Time out has expired and the operation has not been completed.
at System.ServiceProcess.ServiceController.WaitForStatus(ServiceControllerStatus desiredStatus, TimeSpan timeout)
Solution:
Soln 1: This is happening due to incorrect file permissions on panic.log file.
>> Go to C:\ProgramData\Docker
>> Right click on panic.log → Properties
>> Uncheck ‘Read-Only’ and Apply.
Now switching will work fine.
Soln 2:
You can create nopanic.bat file with following data-
attrib c:\programdata\docker\panic.log -r
Save this file in C:\Users\username\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Reference: https://github.com/docker/for-win/issues/11899