Docker Community Forums

Share and learn in the Docker community.

Using Docker Containers in Azure with the Azure Load Balancer

I"ve built a single CentOS 7 and have one container running on it with a mapped port to 8080. I can connect to it via the Azure Public IP. I then built a Azure LB and wanted to use a NAT rule to map 80 on the outside to 8080 on the inside, but the LB seems to want to redirect the client to 8080 on the outside instead of mapping the traffic. I spent 3 hours on the phone with the Azure support and they couldn’t get it to work. Should I be doing something different on the docker networking? It is because it’s a NAT of a NAT basically going through the docker bridge network?

Goal:

I’m trying to use either LB Rules or NAT Rules to map the external IP of the LB to a port of a container running on a VM in Azure (not ACS).

  1. I have the container running on a VM in Azure and can verify the port is up as I can curl to it from the same VNet and connect to it externally using the Public IP and it responds on port PUBLICIP:8080.
  2. I have built a LB Rule that maps it’s Front IP Address Port 80 to the Backend Port of 8080 and the VM mentioned above is in the Backend Pool.
  3. I’ve built a probe TCP Port 8080 used by the rule.

When I try to connect to the Public IP of the LB I see one GET in the web server log of the Container, but then after that a connection is never established. When the Web browser times out the web browser shows the IPADDRESS: 8080. It’s like it redirects the broweser and thus the reason why the connection fails? It should be NATing that traffic? Thoughts?

I recommend taking a look at the Docker for Azure beta: https://beta.docker.com/docs/azure - load balancer configuration is handled automatically.

It’s hard to tell with out details of your app, but I suspect it’s your app doing the redirect because it knows it’s running on port 8080. Have you tried looking at the response your browser gets using the browser developer tooling, or by using curl to debug what the app is doing?