SSH from another machine to container?


I have container that has ssh service in it and it redirects connections that come on certain port, lets say 22321 to another machine. I exposed container port 22321 and mapped it on host port 22321. When try ssh from host machine on port 22321 and container ip i get to that machine to whom docker container reroutes me. The problem is that i cant do that from another machine. For example i want from third machine to ssh to my machine on that port that is mapped to container and to get on third machine to whom docker container reroutes to.

My general goal is to make docker containers that will be connected through vpn to certain networks and i can access machines on those network with ssh to port that redirects there instead of always having to first connect to VPN(docker container will be connected to VPN all the time).

The problem are the red lines on the picture, ssh from outside of host machine where docker is cannot come to container, i think that part of the problem is that host where docker container is listens only on IPv6(:::22321) and i would like it to listen on IPv4 too, so it should have( I tried to map portsdocker run -p that didnt help.

So does anyone have ideas what i could try to make machine at bottom be able to go container on specific port?

edit: on host on middle its :::22321 and not 33122

submitted by /u/Belutak
[link] [comments]
Source: Reddit