使用docker和hosts文件 [英] Using docker and hosts file
问题描述
我试图让一个hbase容器运行,并且容器需要一些东西,这意味着docker主机需要作为docker可用。我们通过在docker的hosts文件中设置docker ip来实现这一点。但是,当我运行:
I'm trying to get an hbase container running, and the container requires some stuff which means the docker host need to be available as "docker". We achieve this with setting the docker ip in the hosts file with docker. However, when I run:
docker ps
它告诉我,证书是为localhost而不是docker。以下作品:
it tells me that the certificate is for localhost and not docker. The following works:
docker --tlsverify = false ps
我的问题是:
*是否可以更新某些东西,以便docker ps可以工作?
*是否可以通过一些环境变量关闭tls验证?
My questions are: * Is it possible to "update" something so that docker ps works? * Is it possible to turn off tls verification through some environment variable?
我尝试将DOCKER_TLS_VERIFY设置为0,并且没有起作用。我知道关闭tls是不安全的,但这是针对dev,而其他自动化脚本期望运行时不指定--tlsverify = false。
I tried setting DOCKER_TLS_VERIFY to 0, and that didn't work. I know turning off tls is insecure, but this is for dev, and other automated scripts expect to run without specifying --tlsverify=false.
推荐答案
您可以考虑(测试)为docker 和 localhost生成证书(在 SubjectAltName
)
You could consider (for testing) to generate a certificate for docker and localhost (adding the latter in SubjectAltName
)
将本地主机添加到主题替代名称可能有缺点,但在您的情况下,它将允许 docker ps
运行任何地方。
Adding localhost to Subject Alternative Name can have drawbacks, but in your case, it would allow docker ps
to run properly anywhere.
这篇关于使用docker和hosts文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!