我有一个带有辅助IP的debian根服务器,我想将其用于docker php / apache容器。 服务器IP:80.X.X.X.X 由主机分配的新/ IP:46.X.X.X
我希望所有对46.X.X.X:80/443的调用最终都在docker容器内并尝试:
docker run -d --name php-recent -p 46.X.X.X:80:80 -p 46.X.X.X:443:443 my-php-app
返回
docker: Error response from daemon: failed to create endpoint php-recent on network bridge: Error starting userland proxy: listen tcp 46.X.X.X:443: bind: cannot assign requested address.
我之前尝试执行ip route add 46.X.X.X/32 dev docker0
并激活IP4转发sysctl -w net.ipv4.ip_forward=1
- >没有帮助。
debian系统上的ifconfing响应是这个
br0 Link encap:Ethernet HWaddr 6c:*
inet addr:80.X.X.X Bcast:85.Y.Y.Y. Mask:255.255.255.224
inet6 addr: fe80::x:x:x:x/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2409691 errors:0 dropped:0 overruns:0 frame:0
TX packets:2995577 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1317423411 (1.2 GiB) TX bytes:2053704233 (1.9 GiB)
br64 Link encap:Ethernet HWaddr e6:*
inet addr:172.30.x.x Bcast:172.x.x.255 Mask:255.255.255.0
inet6 addr: fe80::x:x:x:x/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:1926 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:165588 (161.7 KiB)
docker0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0
inet6 addr: fe80::e86c:1aff:fe23:b64b/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:136 errors:0 dropped:0 overruns:0 frame:0
TX packets:615 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:36853 (35.9 KiB) TX bytes:53198 (51.9 KiB)
eth0 Link encap:Ethernet HWaddr 6c:*
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2902930 errors:0 dropped:8025 overruns:0 frame:0
TX packets:2997498 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1386678228 (1.2 GiB) TX bytes:2053792599 (1.9 GiB)
Interrupt:42 Base address:0x6000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:631737 errors:0 dropped:0 overruns:0 frame:0
TX packets:631737 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:252420138 (240.7 MiB) TX bytes:252420138 (240.7 MiB)
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.8.0.1 P-t-P:10.8.0.2 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)