Sample Header Ad - 728x90

Redirect all incoming and outgoing traffic from a port to a specific ip

1 vote
1 answer
2728 views
I am running a node server inside a docker container on port 8080 and i can access it via 172.17.0.2:8080 (container ip) now i want to access this ip from localhost:9099. I have tried using iptables to redirect this traffic coming at localhost:9099 to 172.17.0.2:8080 but all measures are in vain. This is the command i was using. Please correct me where i am going wrong. Thanks in advance. sudo iptables -t nat -A PREROUTING -p tcp --dport 9099 -j DNAT --to-destination 172.17.0.2:8080 I took help from [this](https://stackoverflow.com/questions/19897743/exposing-a-port-on-a-live-docker-container) ans but didn't work.
Asked by Satnam Sandhu (111 rep)
Jun 18, 2018, 01:21 PM
Last activity: Aug 5, 2025, 02:05 PM