gpt4 book ai didi

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

转载 作者:IT老高 更新时间:2023-10-28 12:35:28 28 4
gpt4 key购买 nike

我在 ubuntu 14.04 上安装了 docker,它告诉我安装成功。然后我输入sudo docker version,它返回了

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 service docker status,我得到了

docker start/running, process 8063

我尝试了 sudo docker imagessudo docker info,得到了同样的回复:

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

不知道为什么会返回这个,我尝试使用 sudo docker pull ubuntu 拉取 ubuntu,得到了

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

请告诉我如何解决这个问题,如何拉取和运行 docker 镜像。 docker -ddocker 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.

关于ubuntu - 无法连接到 Docker 守护程序。 docker 守护进程是否在此主机上运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34471074/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com