之前,安装 Docker 已经可以正常使用了,但是今天突然又不行了,运行
docker ps
命令报错。
错误1: error during connect
详细报错信息如下:
C:\Users\zig>docker ps
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/containers/json:
open //./pipe/docker_engine: The system cannot find the file specified.
★ 解决方法,打开命令行 cmd.exe
:
cd "C:\Program Files\Docker\Docker"
DockerCli.exe -SwitchDaemon
原因:
Especially on windows machine when you see the above error after a docker update, try the above commands.
It appears like the Docker Desktop UI may indicate that you are already using Linux Containers, but the update may have messed up that setting.
Running the above commands will set to Linux Containers and there after you can work happily.
翻译:
特别是在 Windows 系统的机器,当你的 Docker 更新之后会出现上述错误,试试上面的命令。
看起来Docker桌面UI可能表明您已经在使用Linux容器,但是更新可能已经弄乱了设置。
运行上述命令将设置为Linux容器,然后您就可以愉快地工作了。
个人经验:
如何判断你是正确设置到 Linux 容器呢?答:使用 docker info
命令:
- OStype 应该是 linux
错误2:no matching manifest
详细报错信息如下:
C:\Program Files\Docker\Docker>docker pull zookeeper:3.5.9
3.5.9: Pulling from library/zookeeper
3.5.9: Pulling from library/zookeeper
no matching manifest for windows/amd64 10.0.17134 in the manifest list entries
这个问题的原因是当前切换到了 windows 容器,而不是 linux 容器。此时用 docker info
可以查看:
解决方案:
再次使用 DockerCli.exe -SwitchDaemon
错误3:Error response from daemon
详细报错信息如下:
C:\Program Files\Docker\Docker>docker info
Client:
Context: default
Debug Mode: false
Server:
ERROR: Error response from daemon: open \\.\pipe\docker_engine_linux: The system cannot find the file specified.
errors pretty printing info
解决方案:
1、右击计算机,点击管理:
2、点击左侧菜单栏中的服务,在右边找到 Docker Desktop Service, 再点击重启动此服务
参考文档
windows10下安装docker报错:error during connect 阅读