ubuntu – 无法连接到Docker守护程序 docker守护程序是否在此主机上运行?

前端之家收集整理的这篇文章主要介绍了ubuntu – 无法连接到Docker守护程序 docker守护程序是否在此主机上运行?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经安装docker在ubuntu 14.04,它告诉我安装成功。然后我进入sudo docker版本,它返回
Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:12:04 UTC 2015
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

我进入sudo服务docker状态,我得到了

docker start/running,process 8063

我试过sudo docker图像和sudo docker信息,我得到相同的答复:

Cannot connect to the Docker daemon. Is the docker daemon running on this host?

我不知道为什么它返回这个,我试图拉ubuntu使用sudo docker拉ubuntu,并得到了

Using default tag: latest
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

请告诉我如何解决这个问题,我该如何拉和运行docker镜像。是docker -d和docker deamon一样吗?

您需要将当前用户添加到docker组,如下所示:
sudo usermod -aG docker <your username>

另外,可以使用USER环境变量如:

sudo usermod -aG docker $USER

然后重新启动系统。因为docker documentation说:

The docker daemon binds to a Unix socket instead of a TCP port. By default that
Unix socket is owned by the user root and other users can access it
with sudo. For this reason,docker daemon always runs as the root
user.

To avoid having to use sudo when you use the docker command,create a
Unix group called docker and add users to it. When the docker daemon
starts,it makes the ownership of the Unix socket read/writable by the
docker group.

原文链接:https://www.f2er.com/ubuntu/350313.html

猜你在找的Ubuntu相关文章