【发布时间】:2017-08-24 05:14:43
【问题描述】:
我按照cosul docker hub documentation 中的说明在 Eucalyptus 云中启动服务器。然而,除了使用本地主机之外,Http 端口并没有暴露出来
export CONSUL_LOCAL_CONFIG=/root/consul.json
来自1
docker run -d --net=host -e 'CONSUL_LOCAL_CONFIG={"skip_leave_on_interrupt": true}' consul agent -server -bind=127.0.0.1 -bootstrap-expect=1
将绑定地址设置为 127.0.0.1 不会启动服务器;提供 IP 地址,服务器正在启动,但 bot 可访问。我也试过 -P 和 -p 8500:8500 。仍然无法从另一台机器连接。
请注意,这台机器有一个私有 IP 和一个公共 IP。
所以我猜这就是 -net-host 没有从绑定地址开始的原因 还是不清楚。我发现两个类似的线程可以解释这一点
Docker container doesn't expose ports when --net=host is mentioned in the docker run command
【问题讨论】:
-
为什么不试试 docker-compose