在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>
错误代码:
连接过程中出现错误:Get
http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.29/version:开放
/ /。/pipe/docker_engine:系统找不到指定的文件。在
Windows上的默认守护进程配置,必须运行docker客户端
抬高连接。此错误也可能表明docker
Daemon未运行。
解决方案:
1)对于Windows 7命令窗口(cmd.exe),以管理员身份打开cmd.exe,执行如下命令:
docker-machine env --shell cmd default
您将收到以下输出:
SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://192.168.99.100:2376
SET DOCKER_CERT_PATH=C:\Users\USER_NAME\.docker\machine\machines\default
SET DOCKER_MACHINE_NAME=default
SET COMPOSE_CONVERT_WINDOWS_PATHS=true
REM Run this command to configure your shell:
REM @FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd default') DO @%i
复制下面的命令并在cmd上执行:
@FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd default') DO @%i
然后执行以下命令进行控制:
docker version
2)对于Windows 7 Powershell,以管理员身份运行Powershell .exe,执行以下命令:
docker-machine env --shell=powershell | Invoke-Expression
然后执行以下命令进行控制:
docker version
3)如果重新打开cmd或powershell,应再次重复相关步骤。
我知道这个问题是很久以前的问题了,但我没有找到合适的解释和解决方案,所以希望我的答案是有用的:)
假设你在Windows上安装了Docker工具箱,Docker和Docker -machine命令都是可用的。通常,人们在使用这两种方法时都会感到困惑。
docker命令仅在虚拟机中用于管理映像。docker-machine命令用于在主机上管理Linux虚拟机。
所以,请在您的Windows机器上使用docker-machine命令。在虚拟机内部使用docker命令。要使用docker命令,例如docker ps,您可以打开docker快速启动终端,或者在cmd/bash/PowerShell上运行这些命令:
docker-machine run default /假设default是你的Linux虚拟机/
Docker-machine SSH默认
这将启动boot2docker,您将在命令行上看到docker图标。然后可以使用docker命令。
祝你好运。
如果其他答案都不适合你,试试这个:
打开一个终端并运行:
wsl -l -v
如果你注意到Docker -desktop仍然挂在“Installing”状态,关闭Docker,以管理员身份运行powershell并注销Docker -desktop:
PS C:\WINDOWS\system32> .\wslconfig.exe /u docker-desktop
重新启动docker,希望它能工作。如果没有,尝试先卸载docker,然后注销docker-desktop,重新安装docker。
来源:https://github.com/docker/for-win/issues/7295 # issuecomment - 645989416
我在Docker 19.03.12版和Windows 10版上得到了同样的错误。通过以下步骤解决这个问题。希望它能帮助别人。
Go to Windows Start -> Search Box (Type here to search). There
enter 'Services'. Among the listed items, click Services app.
Now search 'Docker Desktop Service' in the Services window opened. Right click on it and Start the service. Its status should be changed to 'Running'.
If step 2 gives error like 'the dependency service failed to start', then start all dependency services. For me, I had to start a service called 'Server'.
Double click 'Docker Desktop' icon in desktop. Now you will see 'Docker Desktop is running' in system tray.
Now run the command 'docker version' from Command Prompt or PowerShell. It should give clean output.
If any issue in step 5, run Command Prompt or PowerShell as administrator.
上述解决方案假设Docker已经安装,并且在您的系统中启用了Hyper-V / Virtualization。
我的一个朋友也有类似的问题,我们尝试了一下,效果很好。
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 10机器上安装:
在安装搜索Windows功能之前,请先搜索并检查Windows hypervisor平台和Linux子系统
WSL 1或WSL 2的安装是强制性的,所以在docker提示您安装时安装它。
https://learn.microsoft.com/en-us/windows/wsl/install-win10
你需要从windows商店安装ubantu(版本16,18或20):
uhelp版本20
安装完成后,可以运行docker -version等命令
或docker在Linux终端运行hello-world。
本视频将帮助你:
https://www.youtube.com/watch?v=5RQbdMn04Oc&t=471s