I am trying to run 2 containers in docker-compose. My docker-compose.yml is:
version: '2'
services:
consul:
image: "consul:0.8.3"
hostname: "consul"
command: "agent -server -client=0.0.0.0 -retry-join=10.30.1.97 -retry-join=10.30.1.42 -bootstrap-expect=3 -ui"
ports:
- "8400:8400"
- "8500:8500"
- "8300:8300"
- "8600:53/udp"
vault:
depends_on:
- consul
image: "vault"
hostname: "vault"
links:
- "consul:consul"
environment:
VAULT_ADDR: http://127.0.0.1:8200
ports:
- "8200:8200"
volumes:
- ./tools/wait-for-it.sh:/wait-for-it.sh
- ./config/vault:/config
- ./config/vault/policies:/policies
entrypoint: /wait-for-it.sh -t 20 -h consul -p 8500 -s -- vault server -config=/config/with-consul.hcl
The problem I get right at the begining is that consul container is not using IP 10.30.1.134 (The IP of the host machine) Instead it is using I think a bridge network:
2017/07/10 10:09:12 [INFO] raft: Node at 172.18.0.2:8300 [Follower] entering Follower state (Leader: "")
How can I force it to use 10.30.1.134?
eth0 Link encap:Ethernet HWaddr 06:f5:74:4c:ad:9e
inet addr:10.30.1.134 Bcast:10.30.1.255 Mask:255.255.255.0
inet6 addr: fe80::4f5:74ff:fe4c:ad9e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:9001 Metric:1
RX packets:9907809 errors:0 dropped:0 overruns:0 frame:0
TX packets:17142864 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1328463684 (1.3 GB) TX bytes:2178517759 (2.1 GB)