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.

  • Docker images versioning for Continuous Integration / Continuous Deployment
  • Can docker-compose directly reference other docker-compose files and start everything in them?
  • How do I link two running docker containers together?
  • Anonymous pull on docker repo in artifactory
  • Unable to install docker
  • How to run HDFS cluster without DNS
  • 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 OSX disc storage
  • How to install nvm in a Dockerfile?
  • Docker volume, change file permissions/owner
  • GitlabCI free shared runners to provision Ubuntu instead of CoreOS?
  • Running alembic in a python container that depends upon a mysql container
  • Docker for non-code deployments?
  • 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 192.168.1.2:5000:localhost:32768

    Here , I can send a request from any physical machine like –
    curl http://192.168.1.2:5000 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.