Version Control System (VSC)

ERROR, preparation failed: error during connect in the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect

Docker-clientrestart

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 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.

Screenshot-2021-10-17-at-02.22.34

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.

Screenshot-2021-10-17-at-18.10.40

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.

Screenshot-2021-10-17-at-02.11.04-1

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.

Screenshot-2021-10-16-at-22.34.39
PS C:\Program Files\Docker\Docker> ./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“.

Screenshot-2021-10-16-at-22.56.57

I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
Kindly subscribe to TechDirectArchive
This is default text for notification bar