Container communication between docker multi-hosts

  1. Configure the Linux kernel to allow IP forwarding.

    $ sysctl net.ipv4.conf.all.forwarding=1
    
  2. will be strategic

    $ sudo iptables -P FORWARD ACCEPT
  3. 错开容器的IP段
  4. 添加路由
  5. docker 130上执行 route add -net 172.18.0.0/16 gw 192.168.18.128
    docker 128上执行 route add -net 172.17.0.0/16 gw 192.168.18.130

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325358211&siteId=291194637