Docker,redirect到virtualbox端口

我有一个本地机器(ip:192.168.1.3),我已经在ip 192.168.53.23上安装了boot2docker(使用https://docs.docker.com/examples/running_ssh_service/创build一个SSH容器)。

我需要使用portforwarding:

  • 能够连接我的dockerssh容器
  • 从本地networking上的另一台机器(ip:192.168.1.x)从特定的端口。 例如192.168.1.2:7000到192.168.53.23:7000

这是我的Dockerfile:

FROM ubuntu:14.04 MAINTAINER Marvin Frachet <mfrachet@id2tel.com> # SSH RUN apt-get update && apt-get install -y openssh-server RUN mkdir /var/run/sshd RUN echo 'root:xxxxxx' | chpasswd RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config # SSH login fix. Otherwise user is kicked off after login RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd ENV NOTVISIBLE "in users profile" RUN echo "export VISIBLE=now" >> /etc/profile EXPOSE 22 CMD ["/usr/sbin/sshd", "-D"] # NodeJS Apache2 RUN apt-get update &&\ apt-get -y upgrade &&\ apt-get -y install nodejs nodejs-legacy nodejs-dev npm git curl apache2 

以下是我如何运行我的容器:

 docker run -d -P --name test_sshd eg_sshd 

然后我使用这一行来获取ssh服务器使用的当前端口:

 sudo docker port test_sshd 22 

我应该做什么来端口,并允许从本地networking的任何地方访问我的SSH容器?

编辑:

我需要的是在运行ssh服务器时指定一个端口。 所以我可以在这个端口上端口