在Windows上执行docker version命令返回的结果如下:

C:\Projects> docker version
Client:
 Version:      1.13.0-dev
 API version:  1.25
 Go version:   go1.7.3
 Git commit:   d8d3314
 Built:        Tue Nov  1 03:05:34 2016
 OS/Arch:      windows/amd64
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.25/version: 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.

运行诊断将产生以下结果:

C:\Projects> wget https://github.com/Microsoft/Virtualization- 
Documentation/raw/master/windows-server-container-tools/Debug- 
ContainerHost/Debug-ContainerHost.ps1 -UseBasicParsin | iex

Checking for common problems
Describing Windows Version and Prerequisites
 [+] Is Windows 10 Anniversary Update or Windows Server 2016 608ms
 [+] Has KB3192366, KB3194496, or later installed if running Windows build 14393 141ms
 [+] Is not a build with blocking issues 29ms
Describing Docker is installed
 [-] A Docker service is installed - 'Docker' or 'com.Docker.Service'  134ms
   Expected: value to not be empty
   27:         $services | Should Not BeNullOrEmpty
   at <ScriptBlock>, <No file>: line 27
 [+] Service is running 127ms
 [+] Docker.exe is in path 2.14s
Describing User has permissions to use Docker daemon
 [+] docker.exe should not return access denied 42ms
Describing Windows container settings are correct
 [-] Do not have DisableVSmbOplock set to 1 53ms
   Expected: {0}
   But was:  {1}
   66:              $regvalue.VSmbDisableOplocks | Should Be 0
   at <ScriptBlock>, <No file>: line 66
 [+] Do not have zz values set 42ms
Describing The right container base images are installed
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.25/images/json: 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.
 [-] At least one of 'microsoft/windowsservercore' or 'microsoft/nanoserver' should be installed 129ms
   ValidationMetadataException: The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
   ParameterBindingValidationException: Cannot validate argument on parameter 'Property'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
   at <ScriptBlock>, <No file>: line 90
Describing Container network is created
 [-] Error occurred in Describe block 1.08s
   RuntimeException: Cannot index into a null array.
   at <ScriptBlock>, <No file>: line 119
Showing output from: docker info

Showing output from: docker version
Client:
 Version:      1.13.0-dev
 API version:  1.25
 Go version:   go1.7.3
 Git commit:   d8d3314
 Built:        Tue Nov  1 03:05:34 2016
 OS/Arch:      windows/amd64

Showing output from: docker network ls

Warnings & errors from the last 24 hours
Logs saved to C:\Projects\logs_20161107-084122.csv
C:\Projects>

当前回答

在我的例子中,WSL2 Linux-Kernel丢失了,下载,执行并重新启动:

https://learn.microsoft.com/de-de/windows/wsl/wsl2-kernel

解决了问题。

其他回答

我的情况是,我在WSL shell中运行docker命令,仍然能够做到这一点,而在git-bash(或另一个基于windows的shell)我面临这个错误。

对我来说,解决方案是这个答案,但重新启动窗口

我的一个朋友也有类似的问题,我们尝试了一下,效果很好。

Hyper-V,尽管在“打开或关闭Windows功能”中被列为活动,但实际上并不是活动的。当在PowerShell下运行systeminfo时,这变得很明显,并且看到 要求被列出为满足(这不是您期望的Hyper-V实际运行的输出)。步骤:

打开“打开或关闭Windows功能” 如果您不确定如何做到这一点,请参考 https://www.howtogeek.com/250228/what-windows-10s-optional-features-do-and-how-to- [turn-them-on-or-off /] [1] 关闭Hyper-V(取消复选框,确保所有子组件都被标记为关闭) 点击“Ok”-你的机器将重新启动。 当你的电脑再次启动时,打开“打开或关闭Windows功能”,然后重新打开Hyper-V。您的机器将重新启动。

现在你可以通过运行docker hello-world image进行测试。

错误与这部分有关:

在Windows上的默认守护进程配置中,docker客户端必须 被提升运行连接

首先,验证Docker Desktop应用程序正在运行。如果没有,启动它:这将运行docker守护进程(只需等待几分钟)。 然后,如果错误仍然存在,您可以尝试切换Docker守护进程类型,如下所示:

Powershell:

以管理员身份打开Powershell 启动命令:& 'C:\Program Files\Docker\Docker\DockerCli.exe' -SwitchDaemon .exe

或者,使用cmd:

以管理员身份打开cmd 启动命令:“C:\Program Files\Docker\Docker\DockerCli.exe”-SwitchDaemon

对我来说,问题是虚拟化没有启用。

在windows 10上:进入任务管理器->性能-> CPU,你应该看到“虚拟化:已启用”部分

如果您没有看到此选项,则意味着尚未启用虚拟化。

另一个要注意的有趣的事情是你必须启用Hyper V。然而,当我使用并行桌面时,我必须启用“嵌套虚拟化”,以使Hyper V“真正启用”。因此,如果您的windows是一个虚拟机,请检查Parallels(或任何您正在使用的)的设置,以启用嵌套虚拟化。

我也有同样的问题。

启动docker守护进程解决了这个问题。只需搜索docker,按下windows键,然后点击“docker Dekstop”。Daemon应该马上就能运行了。

启动Docker Desktop后,确保左下角的Docker守护进程状态为绿色,并在鼠标悬停在其上时显示为RUNNING。