Score:0

Bind Docker port running on localhost to public IP

id flag

I have a docker-compose.yml file which runs a couple of Apache web applications. I have a HAProxy acting as a reverse proxy for the web apps also running inside the container environment. I've exposed the HAProxy port with the directive

ports:
  - 80:80

The web apps, proxy and networking are exactly similar to the setup as described in http://www.inanzzz.com/index.php/post/w14j/creating-a-single-haproxy-and-two-apache-containers-with-docker-compose.

I'm running this in a Google Compute Engine Virtual Machine (CentOS 7). When I run docker-compose up, I'm able to reach the HAProxy at my localhost.

curl http://localhost:80/<url-path>

This works fine.

What I would like to do now is have this HAProxy accessible from a public IP. For example, I'd like to

curl http://<public-ip>:80/<url-path>

and reach the HAProxy.

Currently, the response I'm getting is just a timeout. I'm stuck trying to debug my infrastructure right now. Any help will be much appreciated.

Michael Hampton avatar
cz flag
Check your firewall.
zerodark avatar
id flag
It turned out it was firewall related indeed. For future reference, while creating GCE VMs, you need to use the `--tags=http-server,https-server`.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.