Why HAProxy docker container always exits?

0

I have a docker-compose, which spins up a HAProxy container. It uses wait-for.sh to wait for rails server to be alive. Once the connection is open, HAProxy exits.

HAProxy start command is something like this in the compose file: command: ["./wait-for.sh", "rails-app:10520", "-t", "600", "--", "haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg"]

Valtteri Luoma

Posted 2019-09-06T12:09:44.683

Reputation: 11

Answers

1

Figured it out.

HAProxy has startup parameter -db, which means "disable background mode". So the solution looks like command: ["./wait-for.sh", "rails-app:10520", "-t", "600", "--", "haproxy", "-f", "/usr/local/etc/haproxy/haproxy.cfg", "-db"]

Valtteri Luoma

Posted 2019-09-06T12:09:44.683

Reputation: 11