Why docker container are not able to reach outside of the host inspite of having all the required firewalls rules and ip_forward on Red Hat Enterprise Linux 7 ?

Solution Verified - Updated -

Issue

  • Why docker container are not able to reach outside of the host inspite of having all the required firewalls rules and ip_forward on Red Hat Enterprise Linux 7 ?
    1. iptables rules
Postrouting NAT rule

Chain POSTROUTING (policy ACCEPT 71 packets, 5159 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    3   252 MASQUERADE  all  --  *      !docker0  172.17.0.0/16        0.0.0.0/0           

Forward rule

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         
  697 58548 DOCKER-ISOLATION  all  --  *      *       0.0.0.0/0            0.0.0.0/0           
    0     0 DOCKER     all  --  *      docker0  0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     all  --  *      docker0  0.0.0.0/0            0.0.0.0/0            ctstate RELATED,ESTABLISHED
  697 58548 ACCEPT     all  --  docker0 !docker0  0.0.0.0/0            0.0.0.0/0           
    0     0 ACCEPT     all  --  docker0 docker0  0.0.0.0/0            0.0.0.0/0

2. sysctl ip_forward

[root@test1 sha256]# sysctl -a |grep ip_forward
net.ipv4.ip_forward = 1

Environment

  • Red Hat Enterprise Linux 7
  • docker package

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content