Solved: see my comment.
I've read through, How to access host port from docker container which suggests adding the iptable rules of iptables -A INPUT -i docker0 -j ACCEPT
, however I'd like to only allow this on a specific port.
I've got the following iptable rules:
-A INPUT -s 127.0.0.0/8 -p tcp -m tcp --dport 3000 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 3000 -j DROP
So the intention is to only allow connection from the localhost or docker containers, and not allow external connections to port 3000.
I have tried: -A INPUT -p tcp -m tcp -i docker0 --dport 3000 -j ACCEPT
, however this does not allow access from the container when checking with telnet 172.17.0.1 3000
.
How can I now allow docker to access this port on localhost (the host)?