Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker 避坑

本文涉及的产品
容器镜像服务 ACR,镜像仓库100个 不限时长
简介: 在Ubuntu 18.04.6 WSL中学习Docker时遇到了“Cannot connect to the Docker daemon”错误。通过安装`service`并使用`sudo service docker start`启动Docker,随后能够成功运行`docker ps`和其他命令。参考[Docker官网](https://docs.docker.com/engine/install/ubuntu/?spm=a2c6h.13046898.publish-article.9.5aba6ffac0VIkp)进行安装是通用解决方案。未来若出现新问题,会继续更新。

系统版本:WSL Ubuntu18.04.6

最近搞GPU算力,自学很多云原生知识,还是自己太菜了,我真的是醉了啊,初学docker,执行docker ps,发现这个提示:

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

image.gif

懵逼了,查了很多资料发现Ubuntu系统的版本不同,启动方式也不同!这里适用 service 启动

下面正式说一下我的处理历程:

1. 查资料发现说WSL中没有daemon

我就开始安装daemon,命令如下:

sudo apt-get install daemon

image.gif

image.gif 编辑

2.启动docker

先说一下,我得版本是WSL Ubuntu18.04.6,然后这个版本启动docker命令为:

sudo service docker start

image.gif

然后查看docker状态 :

sudo service docker status

image.gif

image.gif 编辑

Ok,这就启动了!

pull一个镜像试一下

sudo docker pull hello-world
sudo docker run hello-world

image.gif

image.gif 编辑

试试其他的命令:

docker ps

docker images

image.gif 编辑

我目前还是很菜。。。如果上述解决不了,我一般重装了,也很快。。

常用一招!  : Linux系统中安装Docker,可以根据Docker官方网站上的步骤操作。


后续应该还会遇到其它问题,到时候再来更新吧

相关文章
|
10月前
|
Linux Docker 容器
19-Docker-常用命令详解-docker exec
19-Docker-常用命令详解-docker exec
|
4天前
|
Ubuntu Cloud Native Unix
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker 错误
在使用WSL(Ubuntu 18.04.6)时,初学者遇到运行Docker时的错误:“Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?”。解决问题的过程包括:首先尝试通过`sudo apt-get install daemon`安装daemon,然后使用`sudo service docker start`启动Docker。通过`sudo service docker status`确认Docker已启动,并成功运行`docker
|
6月前
|
Unix Docker 容器
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker
|
4天前
|
Unix Docker 容器
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon
docker: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon
513 0
|
9月前
|
Docker 容器
Warning: Stopping docker.service, but it can still be activated by: docker.socket
Warning: Stopping docker.service, but it can still be activated by: docker.socket
188 0
|
JSON Unix 数据格式
docker权限不足Got permission denied while trying to connect to the Docker daemon socket at unix:///var/r
docker权限不足Got permission denied while trying to connect to the Docker daemon socket at unix:///var/r
1949 0
|
消息中间件 JSON Kafka
docker的/var/run/docker.sock参数
/var/run/docker.sock是运行docker容器时常用的数据卷参数,本文就来学习这个参数的用处,揭示背后的原理
721 0
docker的/var/run/docker.sock参数
|
Unix Docker 容器
Win10 WSL运行docker报错:Cannot connect to the Docker daemon at unix:///var/run/docker.sock.
Win10 WSL运行docker报错:Cannot connect to the Docker daemon at unix:///var/run/docker.sock.
579 0
Win10 WSL运行docker报错:Cannot connect to the Docker daemon at unix:///var/run/docker.sock.
|
Linux Docker 容器
【亲测有效】Centos安装完成docker后启动docker报错docker: unrecognized service的两种解决方案
【亲测有效】Centos安装完成docker后启动docker报错docker: unrecognized service的两种解决方案
851 0
|
Unix Docker 容器
connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
http://www.vxiaotou.com