docker安装出现"Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker da

Posted mydailycoding

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker安装出现"Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker da相关的知识,希望对你有一定的参考价值。

今天按照这个教程使用WSL安装docker时遇到了个问题:

  • 使用命令:$ docker search mysql

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

进一步测试发现其他命令也都不能使用

必应搜索一番之后找到了一些解决方案:例如这个博客

$ systemctl daemon-reload
$ sudo service docker restart
$ sudo service docker status

不过我在执行第一个命令时就出现了:

System has not been booted with systemd as init system (PID 1). Can‘t operate

后来找到了这个issue

@craigloewen-msft

"Instead of using sudo systemctl start docker use: sudo /etc/init.d/docker start , as of right now we do not have systemd in WSL 2."

尝试了sudo /etc/init.d/docker start启动docker之后便不再出现片头那个问题

参考资料

https://github.com/MicrosoftDocs/WSL/issues/457

https://www.runoob.com/docker/ubuntu-docker-install.html

https://www.cnblogs.com/mmzs/p/12090197.html

以上是关于docker安装出现"Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker da的主要内容,如果未能解决你的问题,请参考以下文章

docker出现如下错误:Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemo

使用docker安装elasticsearch

Cannot connect to the Docker datemon at tcp://0.0.0.0:2375 is the docker daemon runing?

Docker初次安装运行出错:Cannot connect to the Docker daemon at ***/docker.sock. Is the docker daemon running?

Azure 应用服务使用Docker Compose创建App Service遇见"Linux Version is too long. It cannot be more than 400

docker cannot stop container问题解决