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

我怎么解决这个问题?


当前回答

检查你是否正在使用Docker Machine:)

运行docker-machine env default就可以了。

因为根据文档:

Docker Machine is a tool that lets you install Docker Engine on virtual hosts, and manage the hosts with docker-machine commands. You can use Machine to create Docker hosts on your local Mac or Windows box, on your company network, in your data center, or on cloud providers like AWS or Digital Ocean. Using docker-machine commands, you can start, inspect, stop, and restart a managed host, upgrade the Docker client and daemon, and configure a Docker client to talk to your host. Point the Machine CLI at a running, managed host, and you can run docker commands directly on that host. For example, run docker-machine env default to point to a host called default, follow on-screen instructions to complete env setup, and run docker ps, docker run hello-world, and so forth.

https://docs.docker.com/machine/overview/

其他回答

运行守护进程的命令如下:

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/

这种情况通常不会发生。但是有一天,消息出现了(如下所示),一个简单的重启修复了它

unix:///var/run/ Docker .sock无法连接到Docker守护进程。docker守护进程正在运行吗?

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

在2020年4月的MacOS Catalina上,你只需要打开桌面应用程序:

我知道这篇文章里已经有很多答案了。只是我想补充一个简单的答案,解决上述问题。

sudo systemctl start docker

运行上面的命令,它将启动所有与docker相关的线程/服务。