Skip to content

Latest commit

 

History

History
40 lines (32 loc) · 841 Bytes

README.md

File metadata and controls

40 lines (32 loc) · 841 Bytes

docker-haproxy

Description

Load balancer for 3 web servers. This image was created to deploy a load balancer in a Docker container, to load balance a web server Docker service deployed in a Docker Swarm.

Docker Instructions

Pull the Docker image from Docker Hub:
docker pull xwin/haproxy
Create a container from the image and run it:
docker run -d --name haproxy -p 8080:80 xwin/haproxy

Configure haproxy

Edit the haproxy.cfg file.

Build the container
docker build -t haproxy .
Test the configuration file
docker run -it --rm --name haproxy-syntax-check haproxy -c -f /usr/local/etc/haproxy/haproxy.cfg
Run the container
docker run -d --name haproxy -p 8080:80 haproxy

Test the load balancer

curl localhost:8080