How do I access exposed ports on my Docker containers from outside the VM?

April 17, 2014 17.3k views
So, I've installed Shipyard by following the Quickstart guide, and I now have a container running called `shipyard` which exposes a HTTP server on I can access it just fine from within the droplet using curl, but I can't connect to it over the Internet. I've tried disabling ufw; as well as enabling it, setting DEFAULT_FORWARD_POLICY="ACCEPT" in /etc/default/ufw and allowing port 8000. I've tried using multiple VMs in multiple regions, even. I'm using a newly-created droplet with the Docker image.
1 Answer
You need to set up a proxy to forward the connection on. We have a tutorial explaining how to use nginx to do that:

That should point you in the right direction. Let us know if you need any more help!
by O.S Tezer
In this DigitalOcean article, our goal is to learn about creating a docker container from a base image and building it to run Nginx (layer by layer). Later, following the steps from the beginning, we create a Dockerfile to automate the process using a custom input file for configurations. In the end, using this Nginx docker image, it becomes possible to create self-contained sandboxes running Nginx, which can be used to serve "dockerised" applications.
Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!