欢迎光临散文网 会员登陆 & 注册

WSL2-KALI+DOCKER |解决wsl无法运行docker守护进程

2022-06-16 20:24 作者:ExFANTAZ  | 我要投稿

$sudo systemctl start docker

>>>System has not been booted with systemd as init system (PID 1). Can’t operate.
Failed to connect to bus: Host is down

$docker run hello-world

>>>docker:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

这是目前已经在运行的wsl2系统上安装了docker,但是反复报错Host is down、 Is the docker daemon running?如果上网搜索报错的结果大多是Centos和Ubuntu由于缺失服务器、缺失容器地址,但那是部署的虚拟机或者服务器,并不是在WSL环境下运行的问题。

将搜索改为:在Linux的Windows子系统上(WSL)使用Docker

目前WSL是不支持Docker的守护进程可以使用Docker CLI连接到通过Docker for Windows或您创建的任何其他VM 运行的远程Docker守护进程

参考文章:

WSL2配置docker:https://blog.csdn.net/qq_41490561/article/details/118266330

WSL-Ubuntu配置docker:https://www.codenong.com/s1190000022646202/

win10利用WSL2安装docker的2种方式:https://zhuanlan.zhihu.com/p/148511634    |此文章包括原生linux安装docker方式

Docker官网说明和下载:https://docs.docker.com/desktop/windows/install/

  1. 下载安装Docker Desktop for Windows。需要阅读官网说明WSL 2 backend的部分。你安装了wsl肯定开了Hyper-V,所以相关安装注意事项不必太在意

  2. 设置:

    1. Docker设置General启用:

      1. Expose daemon on tcp://localhost:2375 without TLS

      2. Use the WSL 2 based engine

  1. Docker设置Resources-WSL INTEGRATION

    1. Enable integration with my default WSL distro

    2. kali-linux[启用你的wsl发行版]

    3. Refresh

Apply&Restart

    在kali命令行中输入:

目前你的kali应该已经连上了docker。

    3.在kali命令行中测试:


wsl2-kali已经连接至docker
docker容器里有了一堆hello-world

    如果还在报错,,尝试在首页run一个Ubuntu


WSL2-KALI+DOCKER |解决wsl无法运行docker守护进程的评论 (共 条)

分享到微博请遵守国家法律