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'.

解決方法:html

由於我是非root用戶,所以須要讓你的用戶和docker同屬於一個組(docker所在的組名通常爲docker),能夠用 usermod 命令添加到docker組linux

sudo usermod -aG docker win10docker

而後登出用戶 ctrl+dubuntu

從新登錄segmentfault

再運行一下 docker versionbash

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 worldapp

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/

參考:ide

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

https://segmentfault.com/q/1010000005040763this

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

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

相關文章
相關標籤/搜索