2

I have a server using docker-compose using the image haproxy:1.4. It works fine but I wanted to migrate to a more recent version. But starting with haproxy:2.4, haproxy does not work anymore.

This my config (except from the log configuration, this is the exact same config I had with 1.4):

global maxconn 256 log stdout format raw local0 debug defaults log global option httplog mode http timeout connect 5000ms timeout client 50000ms timeout server 50000ms frontend http-in bind *:80 default_backend test backend test server test test:80 maxconn 256 

test is a container running a web server.

When I curl, I get nothing:

$ curl -vvv 127.0.0.1:80 * Trying 127.0.0.1:80... * TCP_NODELAY set * Connected to 127.0.0.1 (127.0.0.1) port 80 (#0) > GET / HTTP/1.1 > Host: 127.0.0.1 > User-Agent: curl/7.68.0 > Accept: */* > 

Then it just hangs forever (no timeout).

Although I configured the logs, I get no logs from haproxy:

$ docker-compose logs haproxy haproxy_1 | [NOTICE] (1) : New worker #1 (8) forked $ 

Note that with haproxy:2.3 this works. The first version that start failing is 2.4.

Here is the docker-compose config:

 haproxy: image: "haproxy:2.4" ports: - 80:80 sysctls: - net.ipv4.ip_unprivileged_port_start=0 volumes: - "/home/user/config/haproxy/:/usr/local/etc/haproxy/" restart: always 

I had to add net.ipv4.ip_unprivileged_port_start in order to use port 80 but except from this, this is the same configuration as the 1.4 image.

I don't know why the logs do not show up and I don't why it hangs. How to solve or debug this issue?

3
  • I can't reproduce this problem. Using haproxy 2.4 and your configuration, it all just works, and I see logs as expected. See e.g. this test. Commented Mar 23, 2024 at 13:00
  • Thanks for taking the time to reproduce. I see you don't need ip_unprivileged_port_start, are you on a kernel before 4.11? (see hub.docker.com/_/haproxy chapter Run the container). Moreover, I don't understand how you can curl port 80 on the proxy as you are not exposing it outside docker. If you are not able to reproduce the problem, then it must be outside of haproxy and its config. Commented Mar 23, 2024 at 14:48
  • My environment is running as root, so that wasn't necessary. You don't need to publish ports to access them on a container -- you can interact directly with the container ip address. Commented Mar 23, 2024 at 14:58

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.