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

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

解决方法

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

sudo usermod -aG docker win10

然后登出用户 ctrl+d

重新登陆

再运行一下 docker version

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

再跑一下hello world

  1. win10@iZ23a3096aqZ:~$ docker run hello-world
  2. Unable to find image 'hello-world:latest' locally
  3. latest: Pulling from library/hello-world
  4. a9d36faac0fe: Pull complete
  5. Digest: sha256:e52be8ffeeb1f374f440893189cd32f44cb166650e7ab185fa7735b7dc48d619
  6. Status: Downloaded newer image for hello-world:latest
  7. Hello from Docker.
  8. This message shows that your installation appears to be working correctly.
  9. To generate this message,Docker took the following steps:
  10. 1. The Docker client contacted the Docker daemon.
  11. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
  12. 3. The Docker daemon created a new container from that image which runs the
  13. executable that produces the output you are currently reading.
  14. 4. The Docker daemon streamed that output to the Docker client,which sent it
  15. to your terminal.
  16. To try something more ambitIoUs,you can run an Ubuntu container with:
  17. $ docker run -it ubuntu bash
  18. Share images,automate workflows,and more with a free Docker Hub account:
  19. https://hub.docker.com
  20. For more examples and ideas,visit:
  21. 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相关文章