mac上用docker,不需要加sudo
来源:互联网 发布:淘宝考试不在延迟发货 编辑:程序博客网 时间:2024/05/25 21:33
mac上装完boot2docker之后,想测试一下docker,结果书上的例子出错:
$ sudo docker run hello-world
Post http:///var/run/docker.sock/v1.19/containers/create: dial unix /var/run/docker.sock: no such file or directory. Are you trying to connect to a TLS-enabled daemon without TLS?
解决办法:不要加sudo
$ docker run hello-world
Hello from Docker.
This message shows that your installation appears to be working correctly.
...
原因如下:When you use boot2docker
, the docker
daemon is running in a VM, essentially on a different machine. To communicate with adocker
daemon on another machine, you must use the TLS connection (over HTTPS to the daemon's REST API). That's why you had to set upDOCKER_HOST
and DOCKER_CERT_PATH
. Since the daemon is running on a different machine, you don't need to be root to communicate with it because outgoing http connections don't require root, unlike trying to talk with theunix:///var/run/docker.sock
socket.
But when you run sudo docker
, suddenly you're a different user, you'reroot
. The environment variables you set as your regular account are not set. So thedocker
CLI uses its default communication method: the unix
socket. The socket isn't there, because the daemon is running on a different machine (theboot2docker
vm). Hence the error message.
http://stackoverflow.com/questions/27558496/installing-a-web-application-in-a-docker-container-dial-unix-var-run-docker-so
- mac上用docker,不需要加sudo
- 如何使用docker不加sudo
- 使用docker而无须加sudo
- MAC上安装Docker
- mac上安装docker
- docker + sudo
- 不需要sudo打开wireshark
- ubuntu sudo不需要输入密码
- ubuntu sudo不需要输入密码
- 在MAC服务器上搭建docker-registry
- 怎样在mac上彻底删除docker
- mac上安装docker + tensor flow
- 在Mac OS上安装Docker
- docker在Mac上的安装教程
- Mac平台上Docker安装与使用
- 8、MAC 上Docker环境搭建
- Mac上[ERROR] docker-cli docker ps failed
- docker免去sudo命令
- Fragment,ActionBar,ViewPager实现选项卡实现点击切换Fragment
- 详解android中的AsyncTask
- C语言实现静态链表
- Android LinearLayout中TextView标签项自动换行的一种解决方案
- 部分android小知识点记录
- mac上用docker,不需要加sudo
- SPOJ Query on a tree (树链剖分)
- Android常用知识点总汇
- 关于CXF整合Spring时出现jaxws.xsd无法找到的问题
- uva 540
- 关于block使用的5点注意事项
- 即时演讲
- JavaMail
- hdu1852