SSH port forwarding in Docker

前端 未结 1 1535
温柔的废话
温柔的废话 2021-01-25 17:44

I have these two containers, say backend (CentOs) and mongo. What I would like to have is that from within the backend container I can con

1条回答
  •  太阳男子
    2021-01-25 18:05

    I found the correct SSH port forwarding command

    $> ssh root@mongo -L 27017:localhost:27017 -Nf
    

    Normally the idea with this command is that you map a non-public port - through a public server to you own server/compute.

    * `root@mongo` - the public server
    * -L ::
    * `-Nf` - Do not login
    

    Because the public server and third server are the same computer/container you have to use localhost :)

    0 讨论(0)
提交回复
热议问题