0

I have installed docker on my machine. On the ubuntu container I am using, I've installed all the stuff necessary to remote desktop via RDP. (like xrdp, tightvncserver, etc). Even remote-desktop from my host machine to the docker instance works fine.

Now assume I am trying to remote-desktop the host machine from another remote machine. Is there anyway I can configure my host machine such that it forwards any incoming rdp connection to my docker instance rdp port?

In other words, how can I rdp from a remote host to my target host's docker container running instance?

2 Answers 2

0

This should do it, I'm not familiar with Docker and its configuration, but this should get the data to where you want it.

iptables -t nat -A PREROUTING -p tcp --dport 3389 -j DNAT --to-destination 10.10.0.5:3389
iptables -t nat -A POSTROUTING -p tcp -d 10.10.0.5 --dport 3389 -j SNAT --to-source 192.168.0.2
3
  • How to specify --to-port argument?
    – deostroll
    Mar 29, 2016 at 17:58
  • Actually, try using '--to-destination 192.168.0.0:3389' being your docker container.
    – user508889
    Mar 29, 2016 at 18:08
  • I updated my answer to include SNAT for return traffic. It makes the assumption your docker container is 10.10.0.5 and your host/iptables is 192.18.0.2.
    – user508889
    Mar 29, 2016 at 18:33
0

Sounds like you want to start your container using -p

docker run -p 3389 yourimage

from docker run --help:

-p, --publish list         Publish a container's port(s) to the host (default [])

If you installed the software to the running container (instead of using a Dockerfile), then you actually used docker the wrong way. Then you first have to create an image out of the running container and then start that image:

docker commit [OPTIONS] yourcontainer yourimage
docker run -p 3389 [OPTIONS] yourimage [COMMAND] [ARG...]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .