1

I started an Ubuntu Docker container, installed ssh, run ssh with port 22 attached to it.

$ docker ps
CONTAINER ID   IMAGE          COMMAND             PORTS             
f580e36aa7f0   martin/ssh2    /usr/sbin/sshd -D   0.0.0.0:49154->22/tcp


From my server I can now ssh my container. It work fine!

ssh root@172.17.42.1 -p 49154

But how can I ssh my container from the outside word?
(my server is running in my local network on 192.168.1.8/24)

  • Should I install a load balancer who redirect 192.168.1.8:2222 to 172.17.42.1:49154?
  • Should I need pipework for that? How?
  • Can someone point me in the right decision?
4

1 回答 1

1

您应该已经可以在192.168.1.8:49154连接到您的容器。

您的 ssh 容器绑定到 0.0.0.0(=任何接口)和端口 49154,因此这意味着容器端口 22 可以在主机上的任何接口上的端口 49154 上访问。

于 2014-03-03T06:35:58.777 回答