当我把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 CE应用程序

操作系统

使用新的Docker社区版macOS应用程序。例如:

卸载到目前为止安装的所有Docker Homebrew包: 酿造卸载docker-compose 酿造卸载docker-machine Brew卸载docker 手动或通过Homebrew-Cask安装应用程序: 酿造安装-桶docker

注意:这个应用程序将创建必要的链接到docker, docker-compose, docker-machine等。

运行应用程序后,在状态菜单中签出Docker鲸鱼图标。 现在你应该能够像往常一样在终端中使用docker、docker-compose、docker-machine命令。

相关:

Brew安装docker不包括docker引擎? 无法连接到macOS上的Docker守护进程

Linux / Windows

从下载页面下载Docker CE,并按照说明进行操作。

其他回答

尝试将当前用户添加到docker组:

sudo usermod -aG docker $USER

然后注销并重新登录。

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服务:

sudo systemctl enable /usr/lib/systemd/system/docker.service

我也有同样的问题。在CentOS 6.5中:

ps aux |grep `cat /var/run/docker.pid`

如果它显示不存在Docker守护进程,那么我输入:

docker -d

然后按Ctrl + D停止Docker。因为我们使用了-d选项,Docker将作为守护进程运行。现在我们可以做:

service docker start

然后我就可以做个分角。这是所有。

注意:如果这些不工作,你可以尝试yum更新,然后再重复这些,因为我yum安装在这些之前。

检查你是否正在使用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/