我是否尝试连接到没有 TLS 的启用 TLS 的守护进程? [英] Am I trying to connect to a TLS-enabled daemon without TLS?
问题描述
我正在尝试了解 Docker,但我不断收到(对我而言)神秘的错误消息.
I'm trying to learn about Docker, but I keep getting cryptic (to me) error messages.
可能最简单的例子是尝试打印我安装的 Docker 版本:
Possibly the simplest example of this is trying to print the version of Docker I installed:
$ sudo docker version
Client version: 1.4.1
Client API version: 1.16
Go version (client): go1.3.3
Git commit (client): 5bc2ff8
OS/Arch (client): darwin/amd64
FATA[0000] Get http:///var/run/docker.sock/v1.16/version:
dial unix /var/run/docker.sock: no such file or directory.
Are you trying to connect to a TLS-enabled daemon without TLS?
我刚刚阅读了用户指南并严格按照每一步操作,所以我'我很惊讶收到这条消息...我现在该怎么办?
I've just been going through the user guide and following every step exactly, so I'm surprised that I get this message... What should I do now?
我只是注意到如果我不使用 sudo
我不会收到错误:
I just noticed that if I don't use sudo
I don't get the error:
$ docker version
Client version: 1.4.1
Client API version: 1.16
Go version (client): go1.3.3
Git commit (client): 5bc2ff8
OS/Arch (client): darwin/amd64
Server version: 1.4.1
Server API version: 1.16
Go version (server): go1.3.3
Git commit (server): 5bc2ff8
当然,这不是解决方案,因为我可能需要在路上的某个地方使用 sudo
...
Of course, this is not a solution as I may need to use sudo
somewhere down the road...
我刚刚发现另一个页面说如果您使用的是 OS X 那么你不应该使用 sudo
."我不知道他们的意思是仅针对那个示例,还是一般情况.
I just found another page saying "If you're using OS X then you shouldn't use sudo
." I don't know if they mean only for that example, or in general.
推荐答案
对我来说,运行 $(boot2docker shellinit 2>/dev/null)
解决了这个问题.
For me, running $(boot2docker shellinit 2> /dev/null)
fixed the problem.
这会在您当前的终端会话中运行 boot2docker shellinit
命令的输出(三个 set -x ...
行),这让 docker
命令知道在哪里可以找到 boot2docker 虚拟机.
This runs the output of the boot2docker shellinit
command (the three set -x ...
lines) in your current terminal session, which lets the docker
command know where to find the boot2docker virtual machine.
将 $(boot2docker shellinit 2>/dev/null)
添加到 ~/.bash_profile
文件的底部将确保 docker
命令已配置,每次打开终端时.
Adding $(boot2docker shellinit 2> /dev/null)
to the bottom of your ~/.bash_profile
file will make sure the docker
command is configured, every time you open your terminal.
对于使用 Fish shell 的人:boot2docker shellinit ^/dev/null |源码
.
For people using Fish shell: boot2docker shellinit ^ /dev/null | source
.
注意2>/dev/null
(和 Fish 等效的 ^/dev/null
)是可选的.就像@pablo-fernandez 建议的那样,这隐藏了 Writing ..
行.
Note that 2> /dev/null
(and the Fish equivalent ^ /dev/null
) are optional. Like @pablo-fernandez suggested, this hides the Writing ..
lines.
这篇关于我是否尝试连接到没有 TLS 的启用 TLS 的守护进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!