【发布时间】:2018-12-11 21:30:33
【问题描述】:
我是 mongodb 的新手,据我所知,我们总是在 mongod.conf 文件中将 127.0.0.1 或 172.17.0.5 等常量 IP 值作为绑定 IP 传递。
这是我的 mongod.conf 中的绑定 ip 配置>
net:
port: 27017
bindIp: 127.0.0.1, 172.17.0.5 # Listen to local interface only, comment to listen on all interfaces.
我在 /etc/environment 文件中定义了一个环境变量 DHOST= 172.17.0.5
当我尝试在 mongod.conf 中提供以下配置时,我无法连接到 mongo shell:
net:
port: 27017
bindIp: 127.0.0.1, *$DHOST* # Listen to local interface only, comment to listen on all interfaces.
请帮我在 mongo db 配置中添加一个 ENV var 作为绑定 ip
【问题讨论】:
标签: mongodb docker docker-compose centos7