win10 安装docker报错问题

win10 安装docker报错问题

在运行docker version / docker image ls 之类报错:
大概是这样的:

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

或者:
2. error during connect: This error may indicate that the docker daemon is not running...

或者:
3. WSL2  installation is incoplete 
   The WSL2 Linux kernel....

大概常见的是上面的。

解决方式

参考了其它博客很多都是执行下面代码的

1) cd "C:\Program Files\Docker\Docker"
2) ./DockerCli.exe -SwitchDaemon

得出结论:没什么用,白搭…

接下来是正确的方式:
只要看到过上面第三点错误的(WSL 2…)之类的或者运行了刚刚两个白搭命令后没有解决问题的

可以解决问题的流程

  1. 为 Linux 启用 Windows 子系统
    在 Windows 上安装任何 Linux 发行版之前,您必须首先启用“适用于 Linux 的 Windows 子系统”可选功能。
    以管理员身份打开 PowerShell (开始菜单 > PowerShell > 右键单击 > 以管理员身份运行)并输入以下命令:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
  1. 启用虚拟机功能
    在安装 WSL 2 之前,您必须启用虚拟机平台可选功能。您的机器将需要虚拟化功能才能使用此功能。
    以管理员身份打开 PowerShell 并运行:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  1. 下载 Linux 内核更新包
    64位:
    下载更新包
    安装:一直next
    下载官网参考:https://docs.microsoft.com/en-us/windows/wsl/install-manual
  2. 将 WSL 2 设置为默认版本
    打开 PowerShell 并运行以下命令,将 WSL 2 设置为安装新 Linux 发行版时的默认版本:
	wsl --set-default-version 2

把这个 WSL2 Linux kernel update package for x64 machines 升级包安装之后,Docker desktop 就能顺利启动
注意:如果还是不行就再运行一下刚刚的两个白搭命令,这样就可以真的顺利启动

测试是否成功:Docker desktop会变绿色,或者运行docker 的一些命令就知道了。
小的不才,就是这样安装搞定的。

题外内容

更换镜像源地址China官方镜像:https://registry.docker-cn.com、http://f1361db2.m.daocloud.io
在这里插入图片描述

apply就可以。

猜你喜欢

转载自blog.csdn.net/weixin_48770699/article/details/124942069