Git Product home page Git Product logo

Comments (7)

hawkhsieh avatar hawkhsieh commented on May 28, 2024

I have a similar problem about the registrator's IP is filled into the container's IP.

from registrator.

andyshinn avatar andyshinn commented on May 28, 2024

For etcd, the workaround at the moment is to use the -internal flag. While the documentation states it will use the docker0 interface IP, it actually registers the container IP address.

from registrator.

crhuber avatar crhuber commented on May 28, 2024

is there a workaround if you're using consul? I only want to allow my containers to discover the service on another container within the same host. I only have 1 host

from registrator.

dantian avatar dantian commented on May 28, 2024

I also tested the Registrator on consul, and see the same issue. The following is the string rendered from a haproxy template file for servers:

baseStr="server ci05:mad_archimedes:8085 172.17.2.121:49226 check"

The ip address 172.17.2.121 is the docker container internal ip address, not the native host, which is ci05, IP address. So I created a python script to parse this line, use dig to query the IP address for ci05, and replace the IP address to create the following new line for the above line

server ci05:mad_archimedes:8085 172.20.2.147:49226 check

Using consul-template, once the consul template file get rendered, run a script like the following to fix the IP address in the Haproxy cfg file, before restarting Haproxy.

Use the following regex to test haproxy server config lines

serverRegex=re.compile('\ server . .* check\ *')

Use the following loop to scan the haproxy cfg file, and fix the IP address in the server setting line.

with open(haproxy.cfg) as f:
for line in f:
       line=line[:-1]
   m=serverRegex.match(line)
   if m:
    newline=fix_addr(line)
    print newline
   else:
    print line

The server setting lines get fixed, printed without the leading spaces as in the original haproxy.cfg file.

This "plugin script to fix config files" after template rendering are applicable for fixing similar issues, not limited to the ip address issue reported here for Registrator.

from registrator.

sdurrheimer avatar sdurrheimer commented on May 28, 2024

Does someone has test the -internal parameter with consul registry since 856084a ?

It seems it doesn't work as intended, I'm still getting the host IP instead of container IP.

from registrator.

psi-4ward avatar psi-4ward commented on May 28, 2024

Same here.

I'm running a CoreOS cluster with Flannel Networklayer and want Registrator to push all ContainerIPs to Consul respecting all Ports exposed in the Dockerfile.

Because of the internal virtual network which connects all containers i use -p only to expose Ports to the public World.

from registrator.

progrium avatar progrium commented on May 28, 2024

The latest version resolves this when using -internal for both etcd and Consul.

from registrator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.