[
{
"Node": "consul-staging-a-1.org",
"Address": "10.0.11.221",
"ServiceID": "mesos-slave-staging-a-1.org:determined_bartik:5000",
"ServiceName": "service1",
"ServiceTags": null,
"ServiceAddress": "",
"ServicePort": 4003
},
{
"Node": "consul-staging-a-1.org",
"Address": "10.0.11.221",
"ServiceID": "mesos-slave-staging-a-1.org:angry_hypatia:5000",
"ServiceName": "service1",
"ServiceTags": null,
"ServiceAddress": "",
"ServicePort": 4007
}
]
这是我从查询Consul服务API(/ v1 / catalog / service / service1)获得的。
我以前用于启动registrator和服务的命令:
docker run -d -v /var/run/docker.sock:/tmp/docker.sock -h $HOSTNAME gliderlabs/registrator consul://consul-staging-a-1.org:8500
docker run -d -p 4003:5000 -e "SERVICE_NAME=service1" docker-training/hello-world
docker run -d -p 4007:5000 -e "SERVICE_NAME=service1" docker-training/hello-world
我做错的任何步骤?如何将主机名分配给ServiceAddress字段?
答案 0 :(得分:1)
我有类似的问题,发现在v6 Consul Registrator之前将ServiceAddress留空,但是在v6(目前是最新的)它是“0.0.0.0”。我试图使用“-ip”选项,但它没有帮助,不知何故它分配容器的内部IP地址。发现相关问题:
在我的情况下,我通过将容器绑定到IP地址来修复它,如:
docker run -d -p 10.0.0.3:4003:5000 -e "SERVICE_NAME=service1" docker-training/hello-world