ZhangZhihui's Blog  

Enable forwarding from Docker containers to the outside world

By default, traffic from containers connected to the default bridge network is not forwarded to the outside world. To enable forwarding, you need to change two settings. These are not Docker commands and they affect the Docker host’s kernel.

  1. Configure the Linux kernel to allow IP forwarding.

    $ sysctl net.ipv4.conf.all.forwarding=1
    
  2. Change the policy for the iptables FORWARD policy from DROP to ACCEPT.

    $ sudo iptables -P FORWARD ACCEPT
    

These settings do not persist across a reboot, so you may need to add them to a start-up script.

 

Copied from: https://docs.docker.com/network/bridge/

posted on 2020-12-31 08:53  ZhangZhihuiAAA  阅读(185)  评论(0编辑  收藏  举报