Link docker container with host

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?

  • How to fork child process in docker container
  • Pushing an image into private registry doesn't work if I deleted this image before via Registry API v2 call
  • How to downloaded from remote location and execute script on container start Docker?
  • How can I use a docker container with a self signed certificate on osx?
  • Why rancher service disconnected sometimes?
  • How to set a docker container's iP?
  • Docker Remote API exec: Command exit code
  • What is the reason for various “executable file not found in $PATH” errors?
  • How to use Docker Remote API to build an image using Dockerfile
  • Docker output of exec command in detach mode
  • Dockerfile vim installation does not work
  • Running docker-container tests on circleCI
  • One Solution collect form web for “Link docker container with host”

    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.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.