docker 启动一个容器失败

Kvm、VMware、Virtualbox、Xen、Qemu 等
回复
hacker85
帖子: 585
注册时间: 2010-02-25 11:19

docker 启动一个容器失败

#1

帖子 hacker85 » 2016-06-14 22:58

o@halo:~$ ps -aux | grep docker
o 22983 0.0 0.0 15952 912 pts/11 S+ 22:55 0:00 grep --color=auto docker
o@halo:~$ sudo service docker start
docker start/running, process 23078
o@halo:~$ docker run hello-world
docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.
See 'docker run --help'.
o@halo:~$

1、这是为什么 ?? docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.

2、看了一下官方的说明 ,Check that the DOCKER_HOST environment variable is not set for your shell. If it is, unset it. 说是和DOCKER_HOST环境变量有关,但这个变量我怎么设置呢?一点不会!
头像
wjchen
帖子: 583
注册时间: 2011-05-02 19:08
系统: ubuntu 12.04

Re: docker 启动一个容器失败

#2

帖子 wjchen » 2016-06-24 14:44

1、可能是docker service由于某种原因当掉了,看一下相关日志里的错误信息吧
2、根据这个说明,应该是不需要设置DOCKER_HOST这个变量

搜了一下,一个可能的解决方法是,先要将当前用户加入docker组中:

代码: 全选

sudo usermod -aG docker $(whoami)
重新登录,再start service,再run
回复