当我把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

我怎么解决这个问题?


当前回答

你试过关机再开机吗?: -)

我在Mac电脑上升级到Docker 1.10.1后也遇到了同样的问题。 我做了以下事情:

在Docker快速入门终端上

美元的出口 美元的出口

then

Docker-machine kill default

然后重启Docker快速启动终端

这解决了我的问题。

其他回答

在Mac OS-X上,这可能只是意味着docker安装已经过时或无法运行。只需从官方网站下载最新的docker并安装即可。

为我工作。

当您不在docker组中时,通常会发生这种情况。您可以通过以下方式将自己添加到docker组:

sudo usermod -aG docker yourusername

or

sudo usermod -aG docker $(whoami)

在此之后,您需要注销并重新登录到服务器。

或者,您可以sudo每个Docker命令。

LINUX

你可以用这个答案https://stackoverflow.com/a/33596140/13997503 即使在使用这个之后,仍然会得到相同的错误。然后你可能已经安装了docker桌面,现在切换到docker引擎

可以使用此命令删除docker桌面服务文件

$ rm -rf ~/.docker

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.

您可以使用该命令

sudo service docker stop && sudo service docker start

OR

sudo service docker restart

简单地重新启动它。