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

我怎么解决这个问题?


当前回答

我今天开始遇到这个问题。然后我看到了很多回复,但似乎没有一个对我有用。首先,大部分指令都指向linux。对于mac版本,他们都在谈论运行docker-machine。如果你安装docker工具箱,我假设你使用docker-machine,因为docker将在windows和mac平台的虚拟机中运行。但是现在是2017年,mac的docker非常稳定,因此不需要使用工具箱。

不知道守护进程是如何停止的。但要重新启动它,我所要做的就是点击“应用程序”,双击docker图标。我被要求更新和重新发布,我接受了。从那以后,一切都很顺利。

其他回答

如果你在OS X上使用Docker工具,请遵循以下步骤。

重新启动守护进程并配置您的环境:

docker-machine restart

然后

docker-machine env

最后,

eval $(docker-machine env)

测试守护进程是否正在运行:

Docker ps -a或Docker -machine ls。这将列出所有的容器。

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

要修复此问题,您需要在终端中发出以下命令。我将解释每一步:

# Uninstall Docker from apt packages
$ sudo apt-get remove docker docker.io

# Remove it from the libraries just to be
# sure it's gone forever
$ sudo rm -rf /var/lib/docker/*

现在,如果你想简化事情并获得更多时间,你可以使用参数installDocker运行我的init脚本:

# Pull the init script from GitHub
$ wget https://github.com/dminca/dotfiles/blob/master/init

# Add rights to run the script
$ chmod 755 init

# Just run the script with the installDocker parameter
$ ./init installDocker

重新启动是可选的,但我建议您这样做,以确保一切正常运行。

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

Docker服务可能没有运行。

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

Sudo systemctl start docker

如果你使用的是Ubuntu/Debian:

Sudo服务启动docker

Docker将开始在您的主机和相应的端口上运行。