- I have tried with the latest version of Docker Desktop
- I have tried disabling enabled experimental features
- I have uploaded Diagnostics
- Diagnostics ID: 011FF991-2BF0-470C-B32F-969A36D91622/20210713121758
Actual behavior
Stumbled upon this issue when upgraded (and subsequently uninstalled and reinstalled) versions 3.5.1 then 3.5.2.
On my machine, WSL2 home directory is the same as the Windows 10 user’s profile folder i.e.
- Windows 10 host:
%USERPROFILE%=C:Users<username>
- Ubuntu WSL2:
$HOME=/mnt/c/Users/<username>
TL;DR
Docker Desktop wont start and complains .dockercontextsmetafe9c6...meta.json
cannot be accessed.
%USERPROFILE%.dockercontexts
is actually a symlink to itself i.e. contexts -> /mnt/c/Users/<username>/.docker/contexts
: no meta.json
would ever be accessed that way.
Workaround 1
Manually remove %USERPROFILE%.dockercontexts
every time before starting Docker Desktop.
Workaround 2
Set USERPROFILE
to a differenet value in the context starting Docker Desktop.
E.g.
@echo off
SET USERPROFILE=C:Users<username>.dockerHOME
"C:Program FilesDockerDockerDocker Desktop.exe"
The directory C:Users<username>.dockerHOME.dockercontexts
would then be created and the symlink /home/<username>/.docker/contexts -> /mnt/c/Users/<username>/.docker/HOME/.docker/contexts
would be valid.
More details
It begins from the UI. Docker Desktop wont start and issues «It looks like there is an error with Docker Desktop, restart it to fix it».
If I wait a couple of minutes, Docker Desktop automatically stops, then another error appears in a pop-up window:
System.Threading.Tasks.TaskCanceledException:
Cancellation token triggered before we finished reading from the stream.
Restarting Docker Desktop leads to the same behavior.
When looking at the log, the most suspicious messages are:
[21:43:17.220][IPCClient ][Info ] (84bb0c71) b16f0a49-GoBackendClient-CSharp C->S GET /ping
[21:43:17.223][GoBackendClient ][Warning] HttpOS Client: connection timed out.
... and later...
[21:43:35.049][ApiProxy ][Error ] Auto restarting process
[21:43:35.049][ApiProxy ][Info ] Starting C:Program FilesDockerDockerresourcescom.docker.proxy.exe -windowsPipe=\.pipedocker_engine_windows -wsl-distro docker-desktop -dockerExe "C:Program FilesDockerDockerresourcesbindocker.exe" -inject-hosts=true
...
[21:43:35.127][ApiProxy ][Error ] Process died
It appears that there is a specific log file for the ApiProxy
in %APPDATA%Dockerloghostcom.docker.proxy.exe.log
. Inside, there was:
time="2021-07-13T16:09:36+03:00" level=fatal msg="ensuring desktop context: querying desktop-linux docker context: open C:\Users\user\.docker\contexts\meta\fe9c6...\meta.json: The file cannot be accessed by the system."
main.main()
win/backend/cmd/com.docker.proxy/main.go:65 +0x545
Indeed the .docker
directory (in the HOME directory) looks like this:
~/.docker$ ls -l
total 0
drwxrwxrwx 1 user user 512 Apr 14 08:51 application-template
-rwxrwxrwx 1 user user 34 Jul 13 16:37 config.json
lrwxrwxrwx 1 user user 35 Jul 13 16:37 contexts -> /mnt/c/Users/user/.docker/contexts
-rwxrwxrwx 1 user user 252 Jul 13 16:05 daemon.json
drwxrwxrwx 1 user user 512 Jun 27 21:52 devenvironments
lrwxrwxrwx 1 user user 40 Jun 27 21:52 features.json -> /mnt/c/Users/user/.docker/features.json
drwxrwxrwx 1 user user 512 Apr 8 16:52 run
drwxrwxrwx 1 user user 512 Feb 4 12:28 scan
contexts
and features.json
are symlinks to themselves.
Now, I removed contexts
especially and the following happens:
- Docker Desktop starts successfully o/ but…
- I can see briefly in the Windows Explorer that a directory named
contexts
is created: this would presumably contain the requiredmeta.json
file - This directory is then somehow removed and the symlink
contexts
is created.
Thus, manually removing the .dockercontexts
symlink before starting Docker Desktop allows this latter to start, but, meh, this is weird.
I did a little more digging and it appears that a symlink is always created at Docker Desktop startup: «$HOME/.docker/contexts
» ->
«where is %USERPROFILE%
mounted/.docker/contexts
«. Whichever contexts
file is overridden (actual directory, symlink to another directory, junction point to another directory) with this symlink, unless it is already an actual symlink to the required target.
Altering the USERPROFILE
value before starting Docker Desktop also allows it to start.
For .dockerfeatures.json
, it alters some Docker Compose commands (e.g.: docker-compose --version
) if it is an empty file. If the symlink does not resolve or is an empty actual JSON file {}
, no apparent effects in my tests.
Expected behavior
Docker Desktop starts normally.
Information
- Windows Version: 20H2 (Build 19042. 1083) Windows 10 Pro
- Docker Desktop Version: 3.5.2 (66501)
- WSL2 or Hyper-V backend? WSL2
- Are you running inside a virtualized Windows e.g. on a cloud server or a VM: Nope
Steps to reproduce the behavior
- Have a WSL2 distribution and enable integration within this distribution
- Inside WSL2: edit
/etc/passwd
and set the user’sHOME
directory to the Windows%USERPROFILE%
value
E.g.
-<wsl_user>:x:1000:1000:,,,:/home/<wsl_user>:/bin/bash +<wsl_user>:x:1000:1000:,,,:/mnt/c/Users/<windows_user>:/bin/bash
- Exit and restart WSL
- Launch Docker Desktop: fails and issues «It looks like there is an error with Docker Desktop, restart it to fix it»
If it succeeds the first time, stop and restart Docker Desktop again. - Stop Docker Desktop
- Manually remove
%USERPROFILE%.dockercontexts
- Launch Docker Desktop again: succeeds
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:workspacesPR-16070srcgithub.comdockerpinatawinsrcDocker.ApiServicesStateMachinesUnstableState.cs:line 36
at Docker.ApiServices.StateMachines.EngineStateMachine.d__15.MoveNext() in C:workspacesPR-16070srcgithub.comdockerpinatawinsrcDocker.ApiServicesStateMachinesEngineStateMachine.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:workspacesPR-16070srcgithub.comdockerpinatawinsrcDocker.DesktopEnginesEngines.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:workspacesPR-16070srcgithub.comdockerpinatawinsrcDocker.CoreCmd.cs:line 36
at Docker.Backend.Processes.WindowsDockerDaemon.TryToStartService(Settings settings, String args, Dictionary2 env) in C:workspacesPR-16070srcgithub.comdockerpinatawinsrcDocker.BackendProcessesWindowsDockerDaemon.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 FilesDockerDockercom.docker.service»
- «C:P/r/ogram FilesDockerDockerresourcesdockerd.exe» —run-service —service-name docker -G docker-users —config-file C:ProgramDataDockerDesktoptmp-d4wdaemon.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 FilesDockerDockerresourcesdockerd.exe» —run-service —service-name docker -G docker-users —config-file C:ProgramDataDockerDesktoptmp-d4wdaemon.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 (bala.one) | Sitecore MVP | Sitecore | OrderCloud | Coveo | Azure
Get the latest posts delivered right to your inbox
Today in this article, we will see resolution steps for errors like the docker daemon is not running.
Issue Description
Docker daemon fails to start up on Windows or stops for some reason and when you try to run any commands:
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.30/info: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows,
the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
OR
if you see any of the below errors while running,
Today we will cover the below resolution as a possible fix to the issue,
- Resolution 1: Restart Docker service
- Other options for Restart -Docker services
- Resolution 2: DockerCli.exe -SwitchDaemon configuration
- Resolution 3 – Restart the docker service using GUI
- Resolution 4 – Firewall settings
- Resolution 5 – Restart
Resolution 1: Restart Docker service
This error meant the docker daemon is unreachable. Docker daemon fails to start up on Windows or stops for some reason and especially when you try to run any commands.
To fix such types of issues restarting the service will resolve the error. If not please check the resolution steps 2 as explained below.
Steps:
From Start ->Search ->Please type in below,
services.msc
This will open the Services Windows GUI. Please restart the Docker Desktop Service” by right click ->restart option. Please make sure the services are in the “Running” state.
Other options for Restart -Docker services
Alternatively one can use the below command to stop and restart the service from any CLI.
net stop com.docker.service
net start com.docker.service
The service name can be retrieved from the service GUI.
Please check and validate if the docker is working fine. If not please use a few other options as mentioned below.
Resolution 2: DockerCli.exe -SwitchDaemon configuration
It could be possible that your Docker CLI is not properly configured for Windows or Linux.
Please use the below commands to point the Docker CLI to either Linux containers or Windows containers.
From Power Shell:
PS C:Program FilesDockerDocker> ./DockerCli.exe -SwitchDaemon
Please check and validate if the docker is working fine. If not please use a few other options as mentioned below.
Resolution 3 – Restart the docker service using GUI
Using Docker Desktop GUI from Settings -> Reset – Restart Docker Desktop.
Once started successfully you shall see a green running icon as below,
Please check and validate if the docker is working fine. If not please use a few other options as mentioned below.
Resolution 4 – Firewall settings
Please check your security software if it is blocking the docker to create a network interface. You should also check firewall software to not block any installation or configuration.
Resolution 5 – Restart
RESTART machine – Universal solution and if it doesn’t work out please raise a help ticket with Docker.
That’s all! Happy coding!
Does this help you fix your issue?
Do you have any better solutions or suggestions? Please sound off your comments below.
References:
- Dockerize an Angular App with NGNIX
- Containerize .NET Core application
Please bookmark this page and share it with your friends. Please Subscribe to the blog to get a notification on freshly published best practices and guidelines for software design and development.
Docker is an open platform for developing, shipping, and running applications and it provides a simple and powerful developer experience, workflows, and collaboration for creating applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production. You can download and install Docker on multiple platforms. Refer to the following guide on how to install and uninstall Docker Desktop on Windows 10 and Windows Server, how to Pull your first Nginx Container Image from Docker Hub and deploy it to your local machine, Azure DevOps and GitHub integration for Docker and Kubernetes deployment, how to create a static pod in Kubernetes, and how to install, register and start GitLab Runner on Windows.
This error can also be prompted when you execute the docker version command on Windows. Before using Docker Desktop, you may want to see the Docker Subscription Service Agreement. Here is a link to it.
The following error below occurred because the executor on the file was changed and the GitLab-Runner server was not restarted in order to apply the new changes made. Kindly refer to some of these related guides: How to install Git on macOS, how to clone a repository and install software from GitHub on Windows, Panic: Failed to register the GitLab-runner, you may be having network issues.
Running with gitlab-runner 14.3.1 (xxxxxx)
on Windows runner with docker-windows executor xxxxxxxxx
Preparing the "docker" executor
00:07
ERROR: Failed to remove network for build
ERROR: Preparation failed: error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.: Get http://xxxxx/info: open //./pipe/docker_engine: The system cannot find the file specified.
Will be retried in 3s ...
Solution: Restart the Docker service
Ensure all the prerequisites to have Docker Desktop installed and running in your environment are fulfilled. This error meant the docker daemon is unreachable. Docker daemon fails to start up on Windows or stops for some reason and especially when you try to run any commands.
To fix such types of issues restarting the service will resolve the error. This will open the Services Windows GUI.
Please restart the Docker Desktop Service. This can be done by launching the services.msc
from the Run dialog window or Windows Search.
Right-click on Docker Desktop and select the restart option. Please make sure the services are in the “Running” state.
Restart Docker Service Via the command line
The Docker Desktop services can be stopped and restarted with the following commands below. Regardless of the step you use, you will achieve the same result 🙂
net stop com.docker.service net start com.docker.service
Restart docker service using GUI
Using Docker Desktop GUI, click on the troubleshoot icon as shown below and click on Restart.
Also, click on the hidden icon and right-click on Docker. You will find the option to restart Docker. Click on it to have it restarted.
Upon using any of the methods above to restart the Docker Desktop and the GitLab -Runner service, the error was eliminated. If the steps above do not resolve your issues (errors), you may have to Switch Daemon configuration
“Switch to Windows Container” in your host OS is Windows.
PS C:Program FilesDockerDocker> ./DockerCli.exe -SwitchDaemon
This can be done from the command prompt as shown below or from the taskbar by right-clicking on the white whale and select switch to Windows. Here are some similar errors this method can resolve as well: “Docker image OS”windows” cannot be used on this platform: No matching manifest for linux/amd64 in the manifest list entries from Microsoft Docker Registry“, and “The executor requires OSType=windows, but Docker Engine supports only OSType=linux“.
I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.
Hi !
Time to share a weird experience on Windows 10 and Docker. Sometimes, usually after some Windows 10 update or even after a software installation, docker stop responding.
An typical error may look like this.
error during connect: This error may indicate that the docker daemon is not running.: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile.amd64&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&shmsize=0&t=noToday.azurecr.io%2FU%3A0.0.88-amd64&target=&ulimits=null&version=1: open //./pipe/docker_engine: The system cannot find the file specified.
From Visual Studio Code we get:
And it’s very weird. When I check the Docker desktop app, it’s stuck in the the STARTING state.
I can restart the docker desktop app, and I will still have the issue. As I said, weird.
I’m a handy man, so I decided to restart the docker service. Just 2 commands:
Net stop com.docker.service Net start com.docker.service
However, this does not solve the problem. And sometimes, even restarting Windows won’t fix the problem.
After some time, I found the root cause:
Somehow WSL was set to version 1 instead of version 2.
I’m not sure why, however the solution is super easy. Just run a command to set WSL to version 2 and then restart docker service.
wsl --set-default-version 2 Net stop com.docker.service Net start com.docker.service
If you are a visual person, this may look like this:
Important: you need to run these commands with Administrator privileges. So in a Windows Terminal world, this may also look like this. Right click on the Windows Terminal App, and click on “Run as administrator”.
Happy coding!
Greetings
El Bruno
More posts in my blog ElBruno.com.
¿Con ganas de ponerte al día?
En Lemoncode te ofrecemos formación online impartida por profesionales que se baten el cobre en consultoría:
- Si tienes ganas de ponerte al día con Front End (ES6, Typescript, React, Angular, Vuejs…) te recomendamos nuestros Máster Front End: https://lemoncode.net/master-frontend#inicio-banner
- Si te quieres poner al día en Backend (stacks .net y nodejs), te aconsejamos nuestro Bootcamp Backend: https://lemoncode.net/bootcamp-backend#bootcamp-backend/banner
- Y si tienes ganas de meterte con Docker, Kubernetes, CI/CD…, tenemos nuestro Bootcamp Devops: https://lemoncode.net/bootcamp-devops#bootcamp-devops/inicio