我的ISP给了我10个IP地址。 x.x.x.91-95和x.x.x.161-165 我想将9个用于我的容器。
我在x.x.x.91上有主机eth0
所以我做了:
docker network create --subnet x.x.x.0/24 --gateway x.x.x.254 mynet
然后
docker run -it --net mynet --ip x.x.x.165 ubuntu /bin/bash
但我无法连接
PING 8.8.8.8 (8.8.8.8): 56 data bytes
3 packets transmitted, 0 packets received, 100% packet loss
# ifconfig
eth0 Link encap:Ethernet HWaddr 02:42:5b:cc:d2:a5
inet addr:x.x.x.165 Bcast:0.0.0.0 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:16 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1296 (1.2 KB) TX bytes:504 (504.0 B)
# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 x.x.x.254 0.0.0.0 UG 0 0 0 eth0
x.x.x.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
有什么想法吗? Docker版本17.09.0-ce,构建afdb6d4
答案 0 :(得分:1)
我切换到Macvlan驱动程序(由Matt建议) https://docs.docker.com/engine/userguide/networking/get-started-macvlan/