What am I doing wrong?

I’ve tried so many things and I can’t seem to set it up. Without haproxy, I can connect to inspircd1.local via 127.0.0.1, but using swarm and haproxy it doesn’t connect showing:

[ALERT] 112/230926 (1) : parsing [/usr/local/etc/haproxy/haproxy.cfg:17] : 'server inspircd1' : could not resolve address 'inspircd1.local'.
[ALERT] 112/230926 (1) : Failed to initialize server(s) addr.

My configuration of haproxy.cfg is:

global
log 127.0.0.1 local0 notice

defaults
log global
retries 2
timeout connect 3000
timeout server 5000
timeout client 5000

listen inspircd1.local
bind *:6667
mode tcp
option mysql-check user haproxy_check
balance roundrobin
server inspircd1 inspircd1.local:7000 check #inspircd1.local:7000 check

and my docker-compose is:

version: “3.7”
services:

haproxy:
image: haproxy:alpine
volumes:
- ./haproxy/:/usr/local/etc/haproxy/
depends_on:
- inspircd1
ports:
- “6667:6667”
#- “7001:6697”
networks:
- backend

inspircd1:
image: inspircd/inspircd-docker
volumes:
- ./server1/conf/:/inspircd/conf/
environment:
INSP_NET_SUFFIX: .local
INSP_NET_NAME: inspircd1
INSP_SERVER_NAME: inspircd1.local

  INSP_LINK1_NAME: inspircd2
  INSP_LINK1_IPADDR: inspircd2
  INSP_LINK1_SENDPASS: password
  INSP_LINK1_RECVPASS: password
  INSP_LINK1_TLS_ON: "no"
ports:
  - "6667" #client
#  - "6697" #client
  - "7000" #server
#  - "7001" #server
networks:
  - backend
   # aliases:
   #   - inspircd1.local

Thank you for the help!

The HAProxy is not able to resolve the DNS name inspircd1.local. HAProxy 1.5 has added the support to resolve the DNS names through the /etc/resolv.conf file so you can add a static entry there for resolving the DNS name to IP. If you are using HAProxy 1.8 or later, you can have full DNS support by using the resolver keyword. Take a look at https://www.haproxy.com/blog/dns-service-discovery-haproxy/ for details.