registrator: Wrong IP assigned

Hi, i have the same problem of issue #69, run consul + registrator to single host, this is my docker-compose.yml:

consul:
 build: docker-consul/
 ports:
   - "192.168.6.104:8300:8300"
   - "192.168.6.104:8301:8301"
   - "192.168.6.104:8301:8301/udp"
   - "192.168.6.104:8302:8302"
   - "192.168.6.104:8302:8302/udp"
   - "192.168.6.104:8400:8400"
   - "192.168.6.104:8500:8500"
   - "172.17.42.1:53:53/udp"
 hostname: node1
 name: consul
 command: -advertise=172.17.42.1 -server -bootstrap -ui-dir /ui

registrator:
 build: registrator/
 hostname: myhost
 command: consul://192.168.6.104:8500
 volumes:
    - /var/run/docker.sock:/tmp/docker.sock
redis:
 build: redis/
 ports:
  - "6379:6379"
 volumes:
  - /opt/data/redis/:/data

If i run dig for redis container i have this:;

dig @172.17.42.1 redis.service.consul

<<>> DiG 9.9.4-RedHat-9.9.4-18.el7_1.1 <<>> @172.17.42.1 redis.service.consul
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 17238
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;redis.service.consul. IN A

;; ANSWER SECTION:
redis.service.consul. 0 IN A 172.17.0.40

;; Query time: 0 msec
;; SERVER: 172.17.42.1#53(172.17.42.1)
;; WHEN: mer mag 06 09:51:26 CEST 2015
;; MSG SIZE  rcvd: 118

If i run docker inspect c31f2622afe3 | grep IPAddress I have:

"IPAddress": "172.17.0.41", 

Any idea?

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 15 (1 by maintainers)

Most upvoted comments

Use -internal flag to use the container IP: http://gliderlabs.com/registrator/latest/user/run/

Looks like this is all resolved. Please open a new issue if you’re still having a problem.