0

I'm trying to run haproxy on a docker, but it doesn't work.

1-I create haproxy.cfg under /etc/haproxy/haproxy.cfg:

global log 127.0.0.1 local2

chroot      /var/lib/haproxy
pidfile     /var/run/haproxy.pid
user        haproxy
group       haproxy
daemon

stats socket /var/lib/haproxy/stats

defaults mode tcp log global retries 3 timeout queue 1m timeout connect 10s timeout client 1m timeout server 1m timeout check 10s maxconn 3000

listen stats mode http bind *:7000 stats enable stats uri /

listen cluster_pgdocker bind *:5000 option httpchk http-check expect status 200 default-server inter 3s fall 3 rise 2 on-marked-down shutdown-sessions server pg_node1 192.168.154.243:5432 maxconn 1000 check port 8008 server pg_node2 192.168.154.245:5432 maxconn 1000 check port 8008

2-then I create my Dockerfile under /etc/haproxy/:

FROM haproxy:2.3 COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg RUN mkdir --parents /var/lib/haproxy && chown -R haproxy:haproxy /var/lib/haproxy RUN mkdir /var/haproxy

3- Then I execute this command for create an image: docker build -t my-haproxy . 4- docker images: my-haproxy latest d40f9f668bf9 4 seconds ago 99.3MB haproxy 2.3 2739ba6dea2e 3 days ago 99.3MB

5- then I run this image for execute a container:docker run -d --name haproxy -p 7000:7000 my-haproxy:

a6675ebf4437c4eda0d3f120826dd19cee66418926036488e88bfc84896b2cf9 docker: Error response from daemon: driver failed programming external connectivity on endpoint haproxy (7025d8dc3dedcd1c8dcc2da067837639504bec52deadb33d639cd0ba54bc7e05): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 7000 -j DNAT --to-destination 172.17.0.2:7000 ! -i docker0: iptables: No chain/target/match by that name. (exit status 1)).

Please Can you help me and thanks for your support.

ksalhi
  • 1
  • 1

0 Answers0