A abordagem que tomei ao definir algo semelhante foi atribuir estaticamente endereços IP a cada contêiner. Em seguida, "empilhei" os endereços IP como IPs secundários na interface da ponte, vmbr0
.
Minha configuração de rede:
$ ip a l
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:22:15:91:XX:XX brd ff:ff:ff:ff:ff:ff
inet6 fe80::222:15ff:fe91:XXXX/64 scope link
valid_lft forever preferred_lft forever
3: vmbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
link/ether 00:22:15:91:XX:XX brd ff:ff:ff:ff:ff:ff
inet 192.168.1.10/24 brd 192.168.1.255 scope global vmbr0
inet 192.168.1.101/24 scope global secondary vmbr0
inet 192.168.1.103/24 scope global secondary vmbr0
inet6 fe80::222:15ff:fe91:c12d/64 scope link
valid_lft forever preferred_lft forever
4: docker0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
inet 172.17.42.1/16 scope global docker0
Eu adicionei esses IPs secundários da seguinte forma:
$ ip addr add 192.168.1.101/24 dev vmbr0
$ ip addr add 192.168.1.101/24 dev vmbr0
Gostaria de executar meus contêineres da seguinte forma:
$ docker run --name='bind' -d \
-p 192.168.1.101:53:53/udp \
-p 192.168.1.101:10000:10000 sameersbn/bind:latest