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

我怎么解决这个问题?


当前回答

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 nohup docker daemon -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock &

脚本让守护进程在后台运行,在Docker准备就绪后,您可以测试它是否接受命令。

sudo docker info

更多信息请看这个: https://www.upcloud.com/support/how-to-configure-docker-swarm/

我有同样的错误,并尝试docker-machine regenerate-certs或eval..对我没用。

这适用于OS X 10.11.3 (El Capitan)和Docker v1.10.1。我只能通过删除和重新创建docker-machine来修复它。源

如果运行docker-machine ls,它会显示与下面类似的输出;

码头工人 未知的 错误 Unable to query docker version: Cannot 连接到docker引擎端点

试着移除Docker机器;

docker-machine rm -f default

其中默认是Docker机器名。然后;

docker-machine create -d virtualbox default

创建一个新的Docker机器。

再次检查现在一切看起来正常(没有错误或未知Docker):

docker-machine ls

最后,在你继续或运行Docker快速入门终端之前,不要忘记运行“$(Docker -machine env default)”。

执行如下命令:

docker context use default

如果你使用gitlab-ci / gitlab-runners,如果你没有访问/var/run/docker.sock的权限,你就会得到这个错误。

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock

解决问题:

sudo usermod -aG docker gitlab-runner

验证:

sudo -u gitlab-runner -H docker info

希望这能有所帮助。

我在Ubuntu 14.04上运行Docker 1.10时遇到了同样的问题,所有给出的答案都不能正常工作。对我来说,解决办法是在运行Docker守护进程时指定存储驱动程序。

sudo docker daemon --storage-driver=devicemapper