How to access Docker web app from host OS?

I’ve followed the tutorial on the docker.io website here:

http://docs.docker.io/en/latest/examples/python_web_app/

  • nginx and docker: route all requests from each service properly
  • Error saving Docker images to AWS S3 bucket from private Docker Registry
  • “Remove” a VOLUME in a Dockerfile
  • Cron job break other foreground server in docker
  • Docker for windows: cannot access service on exposed port in windows container mode
  • Compile a java file using docker with own path
  • How would I access this app from a browser on my host OS?

  • How to prevent RabbitMQ settings to be lost during intermediate steps of a Dockerfile?
  • How to read environment variable in Nodejs?
  • Mongo DB collections are not found
  • Docker running multiple Apache instances
  • Serving static files directly via a containerized front-end web server?
  • Docker swarm-manager displays old container information
  • 2 Solutions collect form web for “How to access Docker web app from host OS?”

    Docker Remote API provides a way of accessing your Docker images and containers and performing many operations on them, through your Browser.
    Here is the link for Docker API v1.6 Documentation

    Hope it helps.

    The tutorial explains how this works:

    WEB_PORT=$(sudo docker port $WEB_WORKER 5000)
    

    Look up the public-facing port which is NAT-ed. Find the private port used by the container and store it inside of the WEB_PORT variable.

    # install curl if necessary, then ...
    curl http://127.0.0.1:$WEB_PORT
      Hello world!
    

    Access the web app using curl. If everything worked as planned you should see the line “Hello world!” inside of your console.

    Inside the container the application is listening on port 5000. This is translated automatically to an external port number accessible outside of the container. This makes sense because it allows multiple copies of your application to coexist on the same machine, each mapping port 5000 to a uniquely accessible port number for each app instance.

    The documentation on port redirection has more details.

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