Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Is there a bug with the ip_hash directive when trying to use Nginx as an HTTP load balancer from a Docker container?

$
0
0
I have the free version of Nginx running in Docker containers on a RedHat Linux server in AWS. I have configured proxy_pass to act as an HTTP load balancer. There is one Nginx instance that distributes traffic to other Nginx instances running in Docker containers. This distributor container fails if I introduce the ip_hash; directive inside the upstream backend {} section. The default.conf file may have this clause:


...
upstream backend {
server goodname1.com;
server goodname2.com;
server goodname3.com;
}

The above works. I can stop and restart the Docker container. I can prove round-robin distribution happens as I expect too.

If I add the ip_hash directive, the Docker container will never start again. For example, if I modify the default.conf file to look like this:

...
upstream backend {
ip_hash;
server goodname1.com;
server goodname2.com;
server goodname3.com;
}

once I stop the container, I can never restart it. The Docker container is never usable again. This problem is 100% reproducible. Has anyone else experienced this? Is it a bug with Nginx and Docker or am I doing something wrong?

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>