Docker在安装后不工作

我尝试使用linux方法安装docker。 但是当执行$docker run hello-world这个命令时,会输出:

 docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?. See 'docker run --help'. 

关于这个还能做什么?

首先确保守护进程正在运行:

$ps aux|grep "docker daemon"|grep -v "grep"

A)守护进程没有启动( ps没有返回行)

启动不工作的守护进程:

$sudo /usr/bin/docker daemon -H unix:///var/run/docker.sock

或者将其作为服务启动:

$sudo /usr/sbin/service docker start

在这一点上,守护进程已经启动。

B)守护进程启动

正如ps所显示的那样:

[..] /usr/bin/docker daemon -H unix:///var/run/docker.sock

你很高兴与你的第一个容器与一个:

$sudo docker run hello-world


sudo和docker工人

如果你想使用docker而不是sudo (这个你应该,虽然你必须知道安全警告!)一个很好的阅读这将帮助你 。

你必须像sudo一样运行这个命令。

 sudo docker run hello-world 

这会给你足够的权限来执行该操作。

如果你想启用你的用户没有sudo梯级泊坞窗,然后检查出这个答案 。

Interesting Posts