Accessing docker container IP from a different physical machine

I have a server hosted listening on port 8080 on a docker container running on a boot2docker host in my MAC running Yosemite.

If I try to curl the boot2docker IP on port (say 8080) from my machine, I am able to hit the server running in docker container and get the response back.

  • “Unable to write in the cache directory” with Docker and Nginx
  • docker multiply hostnames for one container
  • In Docker WordPress image what causes a delay in copying application files?
  • how can i restore the plugin data of errbot running in a docker container
  • Deploying Flask app with Docker on Elastic Beanstalk: resource creation cancelled error
  • Error when docker start some container
  • What I am interested in doing is that I want to send a request from another machine to this server and get the response back. I tried to add a port forwarding rule using pfctl but that doesn’t seem to work. When I execute the following command on my machine –

    tcpdump -pnti en0 tcp port 8080

    and do a curl on my machine’s IP , I see that something is listening on port 8080 but no response comes back. We have this 2 levels of hierarchy here – my physical machine, the boot2docker running on a box and the docker container running the server. How could I achieve this task of sending request of one machine to another machine having the server in a docker container ?

    Thanks !

  • docker: push image not work
  • How MongoDB works with Docker
  • How to view Chrome settings on XVFB?
  • Kubernetes PetSet - FailedCreate of persistent volume
  • error executing curl command in dockerfile
  • Error with Restcomm docker image when call
  • One Solution collect form web for “Accessing docker container IP from a different physical machine”

    I was able to forward the request coming from another machine but within the same network using this command –

    boot2docker ssh -vnNTL <1st Physical Machine IP>: Any Port :
    boot2docker IP or localhost>: Host port mapped to container’s port

    Example – boot2docker ssh -vnNTL

    Here , I can send a request from any physical machine like –
    curl which will forward the request to my boot2docker’s IP where the container can serve the request and send back the appropriate response and you should see it on the machine where you sent the request from.

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