Closed lucj closed 7 years ago
I do not get why I have eth0, eth1 and eth2 in the Consul container where there are only eth0 and eth1 for the API container.
I'm not sure either, but that most likely is related to the networking configuration of Docker wherever you're deploying. Normally I'd recommend that you use a more specific interfaces
configuration for each job, so that you're picking eth0
from one and eth2
from the other, for example, so they both bind to the IPs on the same subnet.
But if you're deploying both containers onto the same Docker host and getting different network interfaces, I suspect we're missing some information we need here. What does the network environment on the host look like? Does one of the elided Compose services have something different about its network?
@tgross, the diff in the interfaces is due to the fact consul service exposes a port so it's also on the Swarm ingress network. With the consul server, I specify the interface in the -bind option so it gets the correct one.
consul:
image: consul:0.9.2
command: agent -server -client=0.0.0.0 -bootstrap -ui -bind '{{ GetInterfaceIP "eth2" }}'
...
Hi, I have a micro-services application, each one using ContainerPilot 3.3.0. Below is an excerpt of the Compose file I'm using (only consul and api are listed for readability):
When I run the application (not in Triton in this case), I saw that the Consul and the API service do not use the same subnet.
Check within the Consul container (based on autopilotpattern/consul:latest)
I'm not really sure about the origin of the 10.255.x.x on eth0. eth1 is the IP on the Docker0 bridge and eth2 is the IP on a subnet created with an overlay network beforehand (mynet).
Looking at the env set by ContainerPilot:
=> IP is 10.255.0.13 (selected as this is the first private IP ?). I would have prefered one IP on eth2 :)
Check within the API container (image using ContainerPilot)
I do not get why I have eth0, eth1 and eth2 in the Consul container where there are only eth0 and eth1 for the API container.
Looking at the env set by ContainerPilot:
=> the IP is 10.0.1.3, so it cannot contact Consul.
As the net interfaces are not the same for consul and the api services, the first private IP used is not in the same range. Any idea what I'm missing here ?
Should I use additional configuration for each service so it first start to check IP on 192.168.0.0/16 (to be deployed on Triton) and then checks 10.0.1.0/24 network (in case it's deployed outside of Triton, for instance in the case of an external overlay net) ?