Posts

Showing posts with the label Netcat

Access Host's Ssh Tunnel From Docker Container

Answer : Using your hosts network as network for your containers via --net=host or in docker-compose via network_mode: host is one option but this has the unwanted side effect that (a) you now expose the container ports in your host system and (b) that you cannot connect to those containers anymore that are not mapped to your host network. In your case, a quick and cleaner solution would be to make your ssh tunnel "available" to your docker containers (e.g. by binding ssh to the docker0 bridge) instead of exposing your docker containers in your host environment (as suggested in the accepted answer). Setting up the tunnel: For this to work, retrieve the ip your docker0 bridge is using via: ifconfig you will see something like this: docker0 Link encap:Ethernet HWaddr 03:41:4a:26:b7:31 inet addr:172.17.0.1 Bcast:172.17.255.255 Mask:255.255.0.0 Now you need to tell ssh to bind to this ip to listen for traffic directed towards port 9000 via ssh -L 1...