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

其他回答

尝试修改/etc/sysconfig中的Docker配置文件,Docker或Docker -network:

(…~ v1.17)

码头工人文件:

OPTIONS= -H fd://

或(v1.18):

docker-network文件:

DOCKER_NETWORK_OPTIONS= -H unix:///var/run/docker.sock

LINUX

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

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

$ rm -rf ~/.docker

我有同样的错误,并尝试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服务可能没有运行。

如果您使用的是RedHat/Fedora/CentOS,请尝试以下操作:

Sudo systemctl start docker

如果你使用的是Ubuntu/Debian:

Sudo服务启动docker

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.