tproxy icon indicating copy to clipboard operation
tproxy copied to clipboard

Is there a loop in the command?

Open songyu-wang98 opened this issue 3 years ago • 1 comments
trafficstars

I'm new to Docker and I'm confused when I try to understand the command

docker run --rm -it -p <listen-port>:<listen-port> -p <remote-port>:<remote-port> kevinwan/tproxy:v1 tproxy -l 0.0.0.0 -p <listen-port> -r host.docker.internal:<remote-port>

I'm gonna split the command into 2 parts:

  1. docker run --rm -it -p <listen-port>:<listen-port> -p <remote-port>:<remote-port> kevinwan/tproxy:v1: The flag -p map 2 ports of the host to the container, that't alright;
  2. tproxy -l 0.0.0.0 -p <listen-port> -r host.docker.internal:<remote-port>: The -r host.docker.internal:<remote-port> part cause the container access the host port directly, which I think may cause a loop like this:

Docker 端口映射

Could you please help me to figure it out?

songyu-wang98 avatar Sep 29 '22 04:09 songyu-wang98

Yes, I think so. It's actually the same port that the traffic goes to.

kevwan avatar Jan 20 '23 23:01 kevwan