ServiceAddress is empty when using Consul Registrator

[
  {
    "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
  }
]

      

This is what I get from the Consul service API request (/ v1 / catalog / service / service1).

The commands I used to start the logger and services:

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

      

Any steps I am doing wrong? How do I assign a hostname to the ServiceAddress field?

+3


source to share


1 answer


I had a similar problem and found that before the v6 Consul Registrator left the ServiceAddress blank, but in v6 (currently the last one) it is "0.0.0.0". I tried to use the -ip option but it didn't help, somehow it assigns the internal IP of the container. Found related questions at:



In my case, I fixed it by binding the container to an IP, like this:

docker run -d -p 10.0.0.3:4003:5000 -e "SERVICE_NAME=service1" docker-training/hello-world

      

+1


source







All Articles