DOCKER_TLS_VERIFY 和 DOCKER_CERT_PATH 变量有什么作用? [英] What does the DOCKER_TLS_VERIFY and DOCKER_CERT_PATH variable do?

查看:24
本文介绍了DOCKER_TLS_VERIFY 和 DOCKER_CERT_PATH 变量有什么作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Docker 新手,在 Windows 7 上使用 boot2docker.
当我尝试通过 spotify maven 插件配置 Docker 构建时,我被要求设置以下 env 变量:

DOCKER_HOSTDOCKER_CERT_PATHDOCKER_TLS_VERIFY

配置成功但不确定DOCKER_TLS_VERIFYDOCKER_CERT_PATH 变量有什么作用?

解决方案

As README 中提到:

<块引用>

默认情况下,boot2docker 在启用 TLS 的情况下运行 docker.它会自动生成证书并将其存储在 VM 内的 /home/docker/.docker 中.
虚拟机启动后,boot2docker up 命令会将它们复制到主机上的 ~/.boot2docker/certs,并为 DOCKER_CERT_PATH<输出正确的值/code> 和 DOCKER_TLS_VERIFY 环境变量.

eval "$(boot2docker shellinit)" 也会正确设置它们.

<块引用>

出于安全原因,我们强烈建议不要使用未加密的 Docker 套接字运行 Boot2Docker,但如果您有无法轻松切换的工具,您可以通过将 DOCKER_TLS=no 添加到您的 来禁用它/var/lib/boot2docker/profile 文件.

在更动态的环境中,boot2docker ip 可以更改,请参阅 issue 944.

I am new to Docker, using boot2docker on Windows 7.
While I was trying to configure Docker build through spotify maven plugin, I was asked to set below env variables :

DOCKER_HOST
DOCKER_CERT_PATH
DOCKER_TLS_VERIFY

Configuration was successful but am not sure What does the DOCKER_TLS_VERIFY and DOCKER_CERT_PATH variables do ?

解决方案

As mentioned in the README:

By default, boot2docker runs docker with TLS enabled. It auto-generates certificates and stores them in /home/docker/.docker inside the VM.
The boot2docker up command will copy them to ~/.boot2docker/certs on the host machine once the VM has started, and output the correct values for the DOCKER_CERT_PATH and DOCKER_TLS_VERIFY environment variables.

eval "$(boot2docker shellinit)" will also set them correctly.

We strongly recommend against running Boot2Docker with an unencrypted Docker socket for security reasons, but if you have tools that cannot be easily switched, you can disable it by adding DOCKER_TLS=no to your /var/lib/boot2docker/profile file.

In a more dynamic environment, where the boot2docker ip can change, see issue 944.

这篇关于DOCKER_TLS_VERIFY 和 DOCKER_CERT_PATH 变量有什么作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆