Docker Community Forums

Share and learn in the Docker community.

Docker container with bridge public ip


(Manous) #1

Hello
I am on jessie. i have run many container like fedora, debian , lamp … on docker bridge ( docker0 ). I have ip fail over so many public ip i could use.
i have create my own bridge ( vm0) like that :
vm0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether xx:00:xx:f1:xx:xx brd xx:00:xx:f1:xx:xx
inet 87.xxx.xxx.xx7/32 scope global vm0
valid_lft forever preferred_lft forever

i want to use bridge vm0 directly in my ubuntu container. which could permit me to access in my contain outside with my public IP

i start :
sudo docker -bridge=vm0 run -d -it ubuntu

and connect :
sudo docker exec -it 77622c0bb172 /bin/bash

in My container i change interface network :
i add in /etc/network/interfaces:
auto eth0
iface eth0 inet static
address 87.xxx.xxx.xxx
netmask 255.255.255.255
broadcast 87.xxx.xxx.xxx
post-up route add IP dev eth0
post-up route add default gw IP
post-down route del IP dev eth0
post-down route del default gw IP

in container i can’t restart eth0.

Please is it the best way to do ?
Thank


(Tlvu) #2

Did you get an answer? I would like to do the same thing (have a public accessible IP in my container).

Found https://github.com/jpetazzo/pipework, wonder if that is the only way as it clearly state it is a hack.