SSH from another machine to container?

  r/docker

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(0.0.0.0:22321). I tried to map portsdocker run -p 10.0.0.33:22321:22321but 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?

https://imgur.com/a/oUDBffj

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

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

LEAVE A COMMENT