Ubuntu Docker安装运行出错Cannot connect to the Docker daemon

前端之家收集整理的这篇文章主要介绍了Ubuntu Docker安装运行出错Cannot connect to the Docker daemon前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
win10@iZ23a3096aqZ:~$ docker version
Client:
 Version:      1.11.2
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   b9f10c9
 Built:        Wed Jun  1 21:47:50 2016
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?
win10@iZ23a3096aqZ:~$ docker run hello-world
docker: Cannot connect to the Docker daemon. Is the docker daemon running on this host?.
See 'docker run --help'.

解决方法

因为我是非root用户,因此需要让你的用户和docker同属于一个组(docker所在的组名一般为docker),可以用 usermod命令添加到docker组

sudo usermod -aG docker win10

然后登出用户 ctrl+d

重新登陆

再运行一下 docker version

Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 3.13.0-65-generic x86_64)
 
 * Documentation:  https://help.ubuntu.com/
 
Welcome to aliyun Elastic Compute Service!
 
Last login: Fri Jun 17 00:05:03 2016 from 222.44.84.3
win10@iZ23a3096aqZ:~$ docker version 
Client:
 Version:      1.11.2
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   b9f10c9
 Built:        Wed Jun  1 21:47:50 2016
 OS/Arch:      linux/amd64
 
Server:
 Version:      1.11.2
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   b9f10c9
 Built:        Wed Jun  1 21:47:50 2016
 OS/Arch:      linux/amd64

再跑一下hello world

win10@iZ23a3096aqZ:~$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
a9d36faac0fe: Pull complete 
Digest: sha256:e52be8ffeeb1f374f440893189cd32f44cb166650e7ab185fa7735b7dc48d619
Status: Downloaded newer image for hello-world:latest
 
Hello from Docker.
This message shows that your installation appears to be working correctly.
 
To generate this message,Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client,which sent it
    to your terminal.
 
To try something more ambitIoUs,you can run an Ubuntu container with:
 $ docker run -it ubuntu bash
 
Share images,automate workflows,and more with a free Docker Hub account:
 https://hub.docker.com
 
For more examples and ideas,visit:
 https://docs.docker.com/engine/userguide/

参考:

http://www.leesven.com/2338.html

https://segmentfault.com/q/1010000005040763

http://blog.163.com/s2006203387@126/blog/static/533199572015111703735423/

http://www.docker.org.cn/book/install/run-docker-without-sudo-30.html

猜你在找的Ubuntu相关文章