当我把Docker版本更新到0.8.0后,我在输入sudo Docker version时得到了一个错误消息:

Client version: 0.8.0
Go version (client): go1.2
Git commit (client): cc3a8c8
2014/02/19 12:54:16 Can't connect to docker daemon. Is 'docker -d' running on this host?

我按照说明,输入命令sudo docker -d,我得到了这个:

[/var/lib/docker|2462000b] +job initserver()
[/var/lib/docker|2462000b.initserver()] Creating server
open /var/lib/docker/aufs/layers/cf2414da53f9bcfaa48bc3d58360d7f1cfd3784e4fe51fbef95197709dfc285d: no such file or directory[/var/lib/docker|2462000b] -job initserver() = ERR (1)
2014/02/19 12:55:57 initserver: open /var/lib/docker/aufs/layers/cf2414da53f9bcfaa48bc3d58360d7f1cfd3784e4fe51fbef95197709dfc285d: no such file or directory

我怎么解决这个问题?


当前回答

Linux

Linux安装后步骤文档揭示了以下步骤:

创建docker组。 Sudo groupadd docker 将用户添加到docker组。 sudo usermod -aG docker $(whoami) 退出并重新登录以确保docker以正确的权限运行。 码头工人开始。 Sudo服务docker启动

Mac OS X

正如Dayel Ostraco所说,有必要添加环境变量:

docker-machine start # Start virtual machine for docker
docker-machine env  # It's helps to get environment variables
eval "$(docker-machine env default)" # Set environment variables

docker-machine start命令输出注释来指导这个过程。

其他回答

执行ps aux | grep docker查看守护进程是否正在运行。如果没有,执行/etc/init.d /码头工人开始

我也有类似的问题。我不得不注销并再次登录到shell,因为我刚刚安装了Docker,下面的命令在我的环境中没有显示。

export DOCKER_HOST=127.0.0.1:4243 >> ~/.bashrc

我还遇到了“无法连接到Docker守护进程”的问题。这台主机上是否运行docker守护进程?”

我忘了用sudo。希望它能帮助到我们中的一些人。

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

$:sudo docker images
REPOSITORY   TAG   IMAGE ID   CREATED   SIZE

I also had the same issue. The problem was in sockets allocated to docker-daemon and docker-client. First, permission was not set for the docker-client on docker.sock You can set it using "sudo usermod -aG docker $USER" Then check your bash file where the docker-client is running, For me it was on 0.0.0.0:2375, while docker-daemon was running on unix socket.(It was set in the configuration file of dockerd). Just comment the bash-line and it'll work fine. But if you want to make it work on TCP port instead of unix socket, change the configuration file of dockerd and set it on 0.0.0.0.2375 and keep the line in bash as it is if present or set it to 0.0.0.0:2375.

执行如下命令:

docker context use default