Haproxy Docker Image With Correct Logging
This image includes haproxy + rsyslog, correctly supervised by s6.
Test how it does work:
docker run --rm -ti --name test-haproxy -p 1080:80 40ants/haproxy:1.8.20
Then open in browser http://localhost:1080/
Prepare for production
Replace example haproxy config /etc/haproxy.cfg with your own, and ensure you have these options:
global log /dev/log local0
This will tell Haproxy to write log to rsyslog's socket. Rsyslog is configured to redirect all messages to container's stdout.
S6 is supervise both processes and handles system signals, making container to shutdown gracefully
when you hit
docker stop my-proxy.
This images is used some ideas from these posts: