- Load Balancing Three Docker containers with Nginx
- Load Balancing by health check
- Load Balancing by Weight check
-
Please make sure docker engine install in the system; go throuh official documentation: [https://docs.docker.com/engine/install/]
-
Also installed docker-compose in the system; Go throuh official documentation: [https://docs.docker.com/compose/install/]
-
Run with Docker Compose
sudo docker-compose up -d sudo docker-compose ps
-
Go to http://localhost or http://localhost:80
nginx.conf
http {
upstream webapp {
server app01:5000 weight=3;
server app02:5000 max_fails=3 fail_timeout=30s;
server app03:5000;
}
server {
listen 80;
location / {
proxy_pass http://webapp;
}
}
}
events { }