Host unreachable inside Docker container Host unreachable inside Docker container curl curl

Host unreachable inside Docker container


I know it is an old question but for anybody coming here, the solution, at least on Linux, is to allow incoming network packets to host from docker bridge network by modifying the iptables of the host as following:

sudo iptables -I INPUT -i docker0 -j ACCEPT

It translates to accept all incoming network packets on host from docker bridge network (assuming it is docker0) i.e. traffic from docker containers.

Here are the details:

-I INPUT means to insert a netfilter rule for incoming packets to host-i docker0 means packets from docker0 interface of the host-j ACCEPT means accept all packets since a protocol is not defined it implies that packets of any protocol are welcome.

Refer to iptables --help and netfilter website for more details.


The more current approach of using FirewallD would be to execute the following commands:

firewall-cmd --permanent --zone=trusted --change-interface=docker0firewall-cmd --reload


Fedora 32 switched the backend for the firewall from iptables to nftables. I didn't find how to fix things with nftables, however I found how to switch back to iptables.

While the following commands don't look like best practice, they work for me.

sudo sed -i 's/FirewallBackend=nftables/FirewallBackend=iptables/g' /etc/firewalld/firewalld.confsudo systemctl restart firewalld docker

Source: https://dev.to/ozorest/fedora-32-how-to-solve-docker-internal-network-issue-22me