Minikube fails to start on Windows 11 Home and Docker Desktop - docker

I have Windows 11 Home (which does not allow Hyper-V, only Pro edition does).
Installed WSL2 and Docker Desktop.
Installed Minikube using Chocolatey but it refused to start.
Searching on SO, I found this advice in several posts, but it failed to work.
PS C:\WINDOWS\system32> docker system prune
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- all dangling build cache
Are you sure you want to continue? [y/N] y
error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.: Post "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/prune": open //./pipe/docker_engine: The system cannot find the file specified.
PS C:\WINDOWS\system32> minikube delete
* Removed all traces of the "minikube" cluster.
PS C:\WINDOWS\system32> minikube start --driver=docker
* minikube v1.25.2 on Microsoft Windows 11 Home 10.0.22000 Build 22000
* Using the docker driver based on user configuration
X Exiting due to PROVIDER_DOCKER_VERSION_EXIT_1: "docker version --format -" exit status 1: error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/version": open //./pipe/docker_engine: The system cannot find the file specified.
* Documentation: https://minikube.sigs.k8s.io/docs/drivers/docker/

I thought of trying to have Docker Desktop already running before I start minikube.
From the Windows Start menu, I ran Docker Desktop in Administrator mode.
Now I ran the command again
to remove old stuff,
PS C:\WINDOWS\system32> minikube delete
* Removed all traces of the "minikube" cluster.
and now specify the docker driver
PS C:\WINDOWS\system32> minikube start --driver=docker
* minikube v1.25.2 on Microsoft Windows 11 Home 10.0.22000 Build 22000
* Using the docker driver based on user configuration
* Starting control plane node minikube in cluster minikube
* Pulling base image ...
> gcr.io/k8s-minikube/kicbase: 379.06 MiB / 379.06 MiB 100.00% 10.23 MiB p
* Creating docker container (CPUs=2, Memory=3000MB) ...
* Preparing Kubernetes v1.23.3 on Docker 20.10.12 ...
- kubelet.housekeeping-interval=5m
- Generating certificates and keys ...
- Booting up control plane ...
- Configuring RBAC rules ...
* Verifying Kubernetes components...
- Using image gcr.io/k8s-minikube/storage-provisioner:v5
* Enabled addons: storage-provisioner, default-storageclass
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
I don't know kubernetes as I am learning it, but it appears to have worked. I hope this will be useful to someone so they do not have to go off and spend $99 to upgrade to Windows Pro - as I was going to do if this did not work

Related

error during connect: This error may indicate that the docker daemon is not running in cmd

I am a beginner at Docker. I need to create two containers for mongo and mongo-express. But, I'm getting an error as error during connect: This error may indicate that the docker daemon is not running.
Then I tried below steps:
I run the cmd as administrator. Then I run the command "C:\Program Files\Docker\Docker\DockerCli.exe" -SwitchDaemon. It didn't work for me. then I tried with 'C:\Program Files\Docker\Docker\DockerCli.exe' -SwitchDaemon way. Then I enabled hypervisor also. Still, I am getting the same error. When I ran the docker version command in cmd I received the below-mentioned outputs:
Then after I tried with cd "C:\Program Files\Docker\Docker" and ./DockerCli.exe -SwitchDaemon separately.
docker info command gives below mentioned error:
C:\Windows\system32>docker info
Client:
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc., v0.10.0)
compose: Docker Compose (Docker Inc., v2.15.1)
dev: Docker Dev Environments (Docker Inc., v0.0.5)
extension: Manages Docker extensions (Docker Inc., v0.2.17)
sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc., 0.6.0)
scan: Docker Scan (Docker Inc., v0.23.0)
Server:
ERROR: error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/info": open //./pipe/docker_engine: The system cannot find the file specified.
errors pretty printing info
Did you install the Docker Desktop on your Windows PC? If not please install it and Run it. If you already installed it, please run it first!
Then you can see whether the docker engine is starting or not!
After the docker engine started check whether this error is still there. Most probably error will fix after doing that!
If the docker engine is not started, please uninstall docker and delete everything from Registry.
Press Win+R and %appdata%\Docker to go and delete all the files.
Then reinstall the docker, if better you can install the docker desktop. Because with the docker desktop, the docker provides a whole bundle with it! Then you will be able to install the docker for windows smoothly.
Because this error usually getting when the docker engine is not started. Also, this may happen missing Linux kernel on windows. Both issues will address with the correct installation of the Docker Desktop.
You can check whether you have a docker Linux subsystem running on your windows pc by running the following command on cmd,
wsl -l
If you get a result like this,
C:\Users\gayan>wsl -l
Windows Subsystem for Linux Distributions:
docker-desktop-data (Default)
docker-desktop
Then you are okay and ready to go.
If not, please try to uninstall and install the docker desktop
Make sure you delete the previous registry, To do that press Win+R and type Regedit Then go to HKEY_LOCAL_MACHINE -> SOFTWARE -> Docker Inc and delete that folder.
If still you are getting the same error, try to troubleshoot the docker desktop. you can refer to the docker documentation.

Why I got an error while trying to use Minikube as Docker Desktop on Windows?

I have Windows.
I have tried to set up minikube as Docker Desktop and followed the instruction : https://minikube.sigs.k8s.io/docs/tutorials/docker_desktop_replacement/
I do not see any errors in cmd.
C:\WINDOWS\system32>minikube start --container-runtime=docker --vm=true
* minikube v1.28.0 on Microsoft Windows 10 Enterprise 10.0.18363 Build 18363
* Using the hyperv driver based on existing profile
* Starting control plane node minikube in cluster minikube
* Restarting existing hyperv VM for "minikube" ...
* Preparing Kubernetes v1.25.3 on Docker 20.10.20 ...
* Verifying Kubernetes components...
- Using image gcr.io/k8s-minikube/storage-provisioner:v5
* Enabled addons: storage-provisioner, default-storageclass
* Done! kubectl is now configured to use "minikube" cluster and "default" namespace by default
docker --version also works fine.
C:\WINDOWS\system32>docker --version
Docker version 20.10.21, build baeda1f
However when I try to do docker compose up I got an error: error during connect
d:\projects\ui-tests>docker compose up
error during connect: this error may indicate that the docker daemon is not running: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json?all=1&filters=%7B%22label%22%3A%7B%22com.docker.compose.project%3Dui-tests%22%3Atrue%7D%7D": open //./pipe/docker_engine: The system cannot find the file specified.
Can someone help with that?
UPD1:
I have run this command in cmd, but there was no output(do not know if it is ok):
C:\WINDOWS\system32>#FOR /f "tokens=*" %i IN ('minikube -p minikube docker-env --shell cmd') DO #%i
C:\WINDOWS\system32>
The error might have been caused because you are using hyper-v based docker deployment or because of exporting the variables incorrectly. I tried a different approach and it worked for me.
Instead of using hyper-v I have used wsl2 for docker. First you need to
install wsl refer to this doc for more information.
Next you need to download docker engine binary files from the official
docker site and make some configuration as mentioned in this doc.
Now you can install minikube for windows and select the driver as
docker now as docker path is accessible across the system docker-
compose will work fine.
Hope this will help you in resolving your issues.
I was not able to resole this problem. Rancher desktop was chosen instead

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

I'm trying to run Docker in process isolation mode on Windows Server 2019 (Docker Desktop does not work here, my VPS does not support Hyper-V).
I run this in PowerShell (all in Administrator mode)
docker run -it --isolation=process mcr.microsoft.com/windows/servercore:ltsc2019 cmd.exe /c ping 127.0.0.1 -t
Then I get error:
docker: error during connect: In the default daemon configuration on Windows, the docker client must be run with elevated privileges to connect.: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/create: open //./pipe/docker_engine: The system cannot find the file specified.
See 'docker run --help'.
I ran command & 'C:\Program Files\Docker\DockerCli.exe' -SwitchDaemon, as suggested here: Docker cannot start on Windows
However, DockerCli.exe does not exist in a clean Docker install:
As suggested here I tried copying the file DockerCli.exe from my local Windows 10 Docker Desktop installation and reran, but then I get:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Docker.Core, Version=3.0.0.50646, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
at Docker.Cli.MainBackendCli.Run(IReadOnlyCollection`1 args)
at Docker.Cli.MainBackendCli.Main(String[] args)
Regardless, copying files from Docker Desktop does not feel like the right approach.
I then ran dockerd in PowerShell since that's the only other executable in that folder:
Since I'm a newbie, I'm not sure if I just started a container and if so, which one, I just see start., but no idea where that comes from or how I can configure it.
UPDATE 1
Based on Peter Wishart's suggestion I tried uninstall-Package -Name docker, but then I get
uninstall-Package : No package found for 'docker'. At line:1 char:1
+ uninstall-Package -Name docker
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package]
, Exception
+ FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage
Here's the full code of what I tried:
PS C:\Users\Administrator> uninstall-Package -Name docker
uninstall-Package : No package found for 'docker'.
At line:1 char:1
+ uninstall-Package -Name docker
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package]
, Exception
+ FullyQualifiedErrorId : NoMatchFound,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage
PS C:\Users\Administrator> docker
Usage: docker [OPTIONS] COMMAND
A self-sufficient runtime for containers
Options:
--config string Location of client config files (default
"C:\\Users\\Administrator\\.docker")
-c, --context string Name of the context to use to connect to the
daemon (overrides DOCKER_HOST env var and
default context set with "docker context use")
-D, --debug Enable debug mode
-H, --host list Daemon socket(s) to connect to
-l, --log-level string Set the logging level
("debug"|"info"|"warn"|"error"|"fatal")
(default "info")
--tls Use TLS; implied by --tlsverify
--tlscacert string Trust certs signed only by this CA (default
"C:\\Users\\Administrator\\.docker\\ca.pem")
--tlscert string Path to TLS certificate file (default
"C:\\Users\\Administrator\\.docker\\cert.pem")
--tlskey string Path to TLS key file (default
"C:\\Users\\Administrator\\.docker\\key.pem")
--tlsverify Use TLS and verify the remote
-v, --version Print version information and quit
Management Commands:
app* Docker Application (Docker Inc., v0.8.0)
builder Manage builds
cluster* Manage Mirantis Container Cloud clusters (Mirantis Inc., v1.9.0)
config Manage Docker configs
container Manage containers
context Manage contexts
image Manage images
manifest Manage Docker image manifests and manifest lists
network Manage networks
node Manage Swarm nodes
plugin Manage plugins
registry* Manage Docker registries (Docker Inc., 0.1.0)
secret Manage Docker secrets
service Manage services
stack Manage Docker stacks
swarm Manage Swarm
system Manage Docker
trust Manage trust on Docker images
volume Manage volumes
Commands:
attach Attach local standard input, output, and error streams to a running container
build Build an image from a Dockerfile
commit Create a new image from a container's changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
diff Inspect changes to files or directories on a container's filesystem
events Get real time events from the server
exec Run a command in a running container
export Export a container's filesystem as a tar archive
history Show the history of an image
images List images
import Import the contents from a tarball to create a filesystem image
info Display system-wide information
inspect Return low-level information on Docker objects
kill Kill one or more running containers
load Load an image from a tar archive or STDIN
login Log in to a Docker registry
logout Log out from a Docker registry
logs Fetch the logs of a container
pause Pause all processes within one or more containers
port List port mappings or a specific mapping for the container
ps List containers
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rename Rename a container
restart Restart one or more containers
rm Remove one or more containers
rmi Remove one or more images
run Run a command in a new container
save Save one or more images to a tar archive (streamed to STDOUT by default)
search Search the Docker Hub for images
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop one or more running containers
tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
top Display the running processes of a container
unpause Unpause all processes within one or more containers
update Update configuration of one or more containers
version Show the Docker version information
wait Block until one or more containers stop, then print their exit codes
Run 'docker COMMAND --help' for more information on a command.
To get more help with docker, check out our guides at https://docs.docker.com/go/guides/
PS C:\Users\Administrator> Get-PackageProvider -ListAvailable
Name Version DynamicOptions
---- ------- --------------
DockerMsftProvider 1.0.0.8 Update
msi 3.0.0.0 AdditionalArguments
msu 3.0.0.0
NuGet 2.8.5.208 Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag...
PowerShellGet 1.0.0.1 PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, ...
Programs 3.0.0.0 IncludeWindowsInstaller, IncludeSystemComponent
PS C:\Users\Administrator> Get-Package -Name Docker -ProviderName DockerMsftProvider
Name Version Source ProviderName
---- ------- ------ ------------
docker 20.10.0 DockerDefault DockerMsftProvider
PS C:\Users\Administrator> Install-Package -Name docker -ProviderName DockerMsftProvider
The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'DockerDefault'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y
PS C:\Users\Administrator> Install-Package -Name docker -ProviderName DockerMsftProvider
The package(s) come(s) from a package source that is not marked as trusted.
Are you sure you want to install software from 'DockerDefault'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): A
PS C:\Users\Administrator> uninstall-Package -Name docker
WARNING: Docker Service is not available.
uninstall-Package : The property 'Status' cannot be found on this object. Verify that the property exists.
At line:1 char:1
+ uninstall-Package -Name docker
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Microsoft.Power...ninstallPackage:UninstallPackage) [Uninstall-Package],
Exception
+ FullyQualifiedErrorId : PropertyNotFoundStrict,Microsoft.PowerShell.PackageManagement.Cmdlets.UninstallPackage
PS C:\Users\Administrator>
The pipe access that the error message mentions is a (probably unrelated) issue when docker client is run by non-admin users (see here).
I think the most likely explanation is that the docker service has failed to start.
When you ran dockerd you were actually starting an instance of the daemon - and the line API listen on //./pipe/docker_engine means that the system service hadn't started previously - as the instance you started could create the pipe.
If you stop the running dockerd instance and run:
Get-Service docker | Restart-Service
Get-WinEvent -logname application | where ProviderName -eq docker | sort TimeCreated
You should be able to compare the log output with your manual start of dockerd, and see if any errors are blocking the service from starting.
If the event log records API listen on //./pipe/docker_engine then Get-Service docker should show the service as running, and your docker commands should be ok.
[Edit]
Looks like the uninstall of docker was failing because the service doesn't exist.
Yet, the install is succeeding except for the service installation.
You can re-register the service with &'C:\Program Files\Docker\dockerd.exe' --register-service
Maybe this will fail if the VPS provider is somehow stopping services from being registered?
Another option is to run docker interactively in one shell with &'C:\Program Files\Docker\dockerd.exe' --run-service, and run your docker commands in another shell.
To resolve the issue, I just ran & 'C:\Program Files\Docker\Docker\DockerCli.exe' -SwitchDaemon in PowerShell and quit the Docker desktop and Run Docker Desktop as administrator.
Now open command prompt or powershell and run docker images or dockers ps command. It should work.
Go to PowerShell > run as administrator and run this code:
cd "C:\Program Files\Docker\Docker"
./DockerCli.exe -SwitchDaemon
To resolve the issue, I just ran Two Steps in PowerShell.
First,
cd 'C:\Program Files\Docker\Docker
and then,
/DockerCli.exe' -SwitchDaemon
After that, install the WSL Kernel on your machine, restart the WSL machine, then it is resolved.
This solution helped me
https://github.com/docker/for-win/issues/5919#issuecomment-658815006
cd C:\Program Files\Docker\Docker\resources dockerd.exe
Now execute
'docker version' on a new powershell as administrator
Ok so i followed 2 steps and my problem was resolved:
update wsl kernel, seamingly it is a must because docker needs it and it is not installed by default. so just close all docker realated stuff and run:
wsl --update
command in cmd .
I did what other guys said here:
C:\Program Files\Docker\Docker\DockerCli.exe -SwitchDaemon
and voila!
My solution was removing last edition and installing 4.9.1
One other thing to check is whether you have started the Desktop Client for Windows and accepted the License Agreement. I had restored from an image that hadn't had Docker started and was seeing this error. Nothing worked until I accepted the license.
I checked these boxes and it worked for me:

Docker for Windows and WSL1 to Work together

Exactly the same problem as Ubuntu WSL with docker could not be found
$ docker
The command 'docker' could not be found in this WSL 1 distro.
We recommend to convert this distro to WSL 2 and activate
the WSL integration in Docker Desktop settings.
See https://docs.docker.com/docker-for-windows/wsl/ for details.
But my requirement is different -- I want to
stick with WSL1 (for reasons beyond this topic)
and use Docker for Windows as-is
I.e., I have WSL1 and Docker for Windows installed parallel to each other. This is my current info:
C:> ver
Microsoft Windows [Version 10.0.18363.1379]
C:> wsl -l -v
NAME STATE VERSION
* Debian Running 1
I don't see integration in "Resources -> WSL Integration", and I don't have WSL2 backend enabled in Docker Desktop settings.
Just that I'm getting the above problem -- my docker works anywhere, in CMD, Powershell, git-bash, etc, just not in my WSL.
All solutions that I found are to install Docker for Windows within WSL1 or WSL2, but I want to keep everything as is -- WSL and Docker for Windows installed parallel to each other.
Any solution for that?
The command 'docker' could not be found in this WSL 1 distro.
We recommend to convert this distro to WSL 2 and activate
the WSL integration in Docker Desktop settings.
This means in WSL2, it has a real linux kernel which is required to install docker daemon, then in docker-desktop you could have chance to set docker daemon in WSL2. Otherwise, the docker daemon is running in Hyper-V machine. But, if you stick in WSL1, no chance to run docker-daemon in WSL, so the only option is running docker daemon in Hyper-V machine.
Although above is the fact, still we have chance to let you operate docker ps, docker pull etc. in WSL1 bash just like you operate through CMD, Powershell, git-bash, that is allow Docker to accept requests from remote hosts.
For your case, the steps maybe next:
1. Expose docker daemon in docker desktop settings as next, then click Apply & Restart:
2. Install standalone docker client in WSL1:
$ wget https://download.docker.com/linux/static/stable/x86_64/docker-20.10.5.tgz
$ tar zxvf docker-20.10.5.tgz
$ cd docker
3. Set default docker daemon:
$ export DOCKER_HOST=tcp://localhost:2375
4. Verify docker client command:
$ ./docker info
Just FTA, this is the quick hacky workaround that I found, while trying to solve it myself
Change the C:\Program Files\Docker\Docker\resources\bin\docker file to
#!/usr/bin/env sh
#
# Copyright (c) Docker Inc.
binary=$(basename "$0")
"$binary.exe" "$#"
Then docker can work anywhere now, in CMD, Powershell, git-bash, and as well as WSL1.
Note that this hacky workaround is specially for the situation described in OP, might not work for anything else.
I ran the same issue with Ubuntu 20 Distro when trying to use Docker. Below are steps i followed to resole it:
1- I went to microsoft Store and downloaded a recent distro version of the distro, that was Ubuntu 22.04
2- On powershell as admin, i ran the command wsl -l -v to make sure i have the new version
PS C:\WINDOWS\system32> wsl -l -v
NAME STATE VERSION
* Ubuntu Stopped 1
Ubuntu-22.04 Stopped 2
docker-desktop-data Stopped 2
docker-desktop Stopped 2
3- i ran the command: wsl --set-default Ubuntu-22.04 to use wsl 2
I wan now able to use Docker on WSL 2

Docker log (driver json-file) location for Docker for windows

I want to locate a container's log location.
I use Docker Desktop for Windows
I know that on linux they are at /var/lib/docker/containers/
But where is it. Is it hidden away somewhere in an inaccessible VM?
Windows 10 + WSL 2 (Ubuntu 20.04), Docker version 20.10.2, build 2291f61
Logging Driver
docker info --format '{{.LoggingDriver}}'
'json-file'
Docker Inspect LogPath
docker inspect --format='{{.LogPath}}' <Some_Container_id>
'/var/lib/docker/containers/bb69ae7df957c5f8c8b6d63372aa9cf9b94fa6ef0e44ccecbccb6d190baadb51/bb69ae7df957c5f8c8b6d63372aa9cf9b94fa6ef0e44ccecbccb6d190baadb51-json.log'
Docker Artifacts are stored in following location
DOCKER_ARTIFACTS == \\wsl$\docker-desktop-data\version-pack-data\community\docker
Location of container logs
DOCKER_ARTIFACTS\containers\[Your_container_ID]\[Your_container_ID]-json.log
Here is an example:
On windows you can find the containers logs inside:
C:\ProgramData\docker\containers\[Your_container_ID]\[Your_container_ID]-json.log
For windows , the container storage is the Hyper V's virtual Hard disk.You would have to connect to that hard disk to get the container logs.
See this lonk for more details :https://forums.docker.com/t/where-are-images-stored/9794/7

Resources