Reputation: 1950
I would like to forward docker-host port (3389) to docker container so container can connect to 127.0.0.1:3389. Is this somehow possible?
Upvotes: 1
Views: 142
Reputation: 6159
The easiest thing to do would be using --net=host
. That effectively puts the container in the host network (which may not be what you want). Another option would be to talk to the docker host interface.
DOCKER_HOST=`ip route show | grep ^default | awk '{print $3}'`
should figure out the IP of the host inside the container. The latter assumes that the host service listens on that (or all) host interfaces though. There are most likely more tricks achieving what you want using iptables but those two are the simplest I can come up with. You might want to check https://docs.docker.com/articles/networking/ for further details.
Upvotes: 3