DOCKER_TLS_VERIFY和DOCKER_CERT_PATHvariables有什么作用?
我是Docker的新手,在Windows 7上使用boot2docker。
当我试图通过spotify maven插件configurationDocker构build时,我被要求设置下面的envvariables:
DOCKER_HOST DOCKER_CERT_PATH DOCKER_TLS_VERIFY
configuration成功,但不确定DOCKER_TLS_VERIFY
和DOCKER_CERT_PATH
variables的作用是什么?
如自述文件中所述 :
默认情况下,boot2docker在启用TLS的情况下运行docker 。 它会自动生成证书并将其存储在虚拟机内的
/home/docker/.docker
。
一旦VM启动,boot2docker up
命令将把它们复制到主机上的~/.boot2docker/certs
,并为DOCKER_CERT_PATH
和DOCKER_TLS_VERIFY
环境variables输出正确的值。
eval "$(boot2docker shellinit)" will also set them correctly.
为了安全起见,我们强烈build议不要使用未encryption的Docker套接字来运行Boot2Docker,但是如果您有无法轻松切换的工具,则可以通过将
DOCKER_TLS=no
添加到/var/lib/boot2docker/profile
文件来禁用它。
在更dynamic的环境中,boot2docker ip可以更改,请参阅问题944 。
请现在检查下面的评论。 我不是一个围棋开发者,但我理解它的用法。 稍后编辑,因为它太斯巴达人。
从https://github.com/docker/docker/blob/3ea762b9f6ba256cf51bd2c35988f0c48bccf0b0/client/client.go
[...] // Use DOCKER_HOST to set the url to the docker server. // Use DOCKER_API_VERSION to set the version of the API to reach, leave empty for latest. // Use DOCKER_CERT_PATH to load the tls certificates from. // Use DOCKER_TLS_VERIFY to enable or disable TLS verification, off by default. func NewEnvClient() (*Client, error) { var client *http.Client if dockerCertPath := os.Getenv("DOCKER_CERT_PATH"); dockerCertPath != "" { options := tlsconfig.Options{ CAFile: filepath.Join(dockerCertPath, "ca.pem"), CertFile: filepath.Join(dockerCertPath, "cert.pem"), KeyFile: filepath.Join(dockerCertPath, "key.pem"), InsecureSkipVerify: os.Getenv("DOCKER_TLS_VERIFY") == "", [...]