docker, iptables settings

I’m running local docker container which need access to 172.19.0.3 and open ports 3000 and 8080.

Is this please correct setting ?

    iptables -I INPUT -p tcp --dport 3000 -j ACCEPT
    iptables -I OUTPUT -p tcp --dport 3000 -j ACCEPT
    iptables -I INPUT -p tcp --dport 8080 -j ACCEPT
    iptables -I OUTPUT -p tcp --dport 8080 -j ACCEPT
    iptables -I INPUT -p tcp -s 172.19.0.3 -j ACCEPT
    iptables -I OUTPUT -p tcp -d 172.19.0.3 -j ACCEPT

# nft list ruleset
#

Do you need any settings at all? Is any firewall active? What are current firewall settings?

    iptables -I OUTPUT -p tcp --dport 3000 -j ACCEPT
    iptables -I OUTPUT -p tcp --dport 8080 -j ACCEPT

Those are obviously incorrect if the purpose is to allow access from external systems to specific port on your system. They are mostly harmless, but they are useless for your stated goal.

    iptables -I OUTPUT -p tcp -d 172.19.0.3 -j ACCEPT

This may or may not be needed depending on other firewall settings. Usually outgoing packets are not filtered by default at all.

nft list ruleset

iptables and nftables are two different kernel subsystems. Rules configured for one subsystem are obviously not visible in another subsystem. You provided no information what you are using currently.

I’ve had suspicion that firewall was causing problem but it looks like the problem is caused by docker virtual devices. Should I make a new thread ?