Estou seguindo este tutorial
link
Eu usei os seguintes comandos
$ sudo brctl addbr bridge0
$ sudo ip addr add 192.168.0.160/24 dev bridge0
$ sudo ip link set dev bridge0 up
# Confirming that our bridge is up and running
$ ip addr show bridge0
4: bridge0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state UP group default
link/ether 66:38:d0:0d:76:18 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.160/24 scope global bridge0
valid_lft forever preferred_lft forever
# Tell Docker about it and restart (on Ubuntu)
$ echo 'DOCKER_OPTS="-b=bridge0"' >> /etc/default/docker
$ sudo service docker start
Parece funcionar bem, pois vejo que todos os meus conatiner estão recebendo ip nesse intervalo.
Agora, como eu tenho 3 conatiners
mysql 192.168.0.3
redis 192.168.0.5
webserver 192.168.0.6
Agora, se eu pingar redis do servidor da web, ele funciona
mas eu não consigo fazer o ping do host 192.168.0.160
ele diz que o host de destino não é possível
INFO
vagrant@ubuntu-docker-base:/mydocker/containers$ brctl show
bridge name bridge id STP enabled interfaces
bridge0 8000.7e8945d no veth1a8b959
veth404a3b2
veth7959157
docker0 8000.5689799 no
contêiner
root@286329032cd5:/# ip route
default via 192.168.0.160 dev eth0
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.5
root@286329032cd5:/# ping 192.168.0.3
PING 192.168.0.3 (192.168.0.3) 56(84) bytes of data.
64 bytes from 192.168.0.3: icmp_seq=1 ttl=64 time=0.125 ms
64 bytes from 192.168.0.3: icmp_seq=2 ttl=64 time=0.130 ms
64 bytes from 192.168.0.3: icmp_seq=3 ttl=64 time=0.072 ms
^C
--- 192.168.0.3 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.072/0.109/0.130/0.026 ms
root@286329032cd5:/# ping 192.168.0.160
PING 192.168.0.160 (192.168.0.160) 56(84) bytes of data.
From 192.168.0.5 icmp_seq=1 Destination Host Unreachable
From 192.168.0.5 icmp_seq=2 Destination Host Unreachable
From 192.168.0.5 icmp_seq=3 Destination Host Unreachable
^C
--- 192.168.0.160 ping statistics ---
6 packets transmitted, 0 received, +3 errors, 100% packet loss, time 5032ms
pipe 3
root@286329032cd5:/#