bellycard / docker-loadbalancer

121 stars 29 forks source link

Trying to understand how I could use this on a Linux host... #5

Closed nessamurmur closed 9 years ago

nessamurmur commented 9 years ago

In the event that I'm running docker on my local host and not a vm I'm not sure how to get this running... 10.0.2.15 is the ip of your host over virtualbox's interface? Not sure what IP consul should be advertising...

shanesveller commented 9 years ago

Hi there! A good place to start would be to set the address to that of your eth0 or distro-specific equivalent, especially if the host machine only has one "real" network interface. You could also use the IP address of your docker0 interface, but would possibly need to update the ports: lines in the fig.yml to make sure that your published ports bind on that IP address (or to 0.0.0.0).

The important points are that the IP in question should be where Docker is publishing its exposed ports, and it should be routable from within the lb container specifically. You can try that by using something like this:

fig run lb ping $ADDRESS

If you can provide any more context, like the host OS and release/version, Docker/Fig versions, etc. I'd be happy to try to help further.

nessamurmur commented 9 years ago

So I actually figured it out. I used the IP of my host machine on the docker0 interface that docker sets up.

nessamurmur commented 9 years ago
docker0   Link encap:Ethernet  HWaddr CA::FE::C0::FF::EE::00 
          inet addr:172.17.42.1  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::5484:7aff:fefe:9799/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3702374 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3899723 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:4174053937 (4.1 GB)  TX bytes:4236960151 (4.2 GB)
consul:
  command: -server -bootstrap -advertise 172.17.42.1
  image: progrium/consul:latest
  ports:
  - "8300:8300"
  - "8400:8400"
  - "8500:8500"
  - "8600:53/udp"
shanesveller commented 9 years ago

@niftyn8 good to close this issue?

nessamurmur commented 9 years ago

Definitely, thanks!

funkytaco commented 8 years ago

Any way to set that advertised IP via docker-compose? I'm using the free beta Docker Swarm "Carina" by Rackspace. For now, I hardcoded the IP of the Docker Swarm, but I have it set to one node right now, and am thinking this might not work with more nodes, possibly...