Issue with Haproxy docker container

Hi,

I am trying to setup Haproxy container. Below is my haproxy config
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
chroot /var/lib/haproxy
user haproxy
group haproxy
# daemon

    defaults
        mode http
        timeout connect 5000ms
        timeout client 50000ms
        timeout server 50000ms

    frontend http-in
        bind *:80

        acl has_nextcloud path_beg /nextcloud
        acl has_grafana path_beg   /grafana

        
        use_backend grafana if has_grafana
        use_backend nextcloud if has_nextcloud

        default_backend nextcloud

    backend grafana
        reqrep ^([^\ ]*\ /)grafana[/]?(.*)     \1\2
        server grafana grafana:3000 check

    backend nextcloud
        reqrep ^([^\ ]*\ /)nextcould[/]?(.*)     \1\2
        server nextcloud nextcloud:80 check

haproxy is set to run on a docker container as well as nextcloud. But when I start the haproxy container, I am getting the error below
[ALERT] 115/161301 (15) : parsing [/etc/haproxy/haproxy.cfg:38] : Unknown host in ‘nextcloud:80’
[ALERT] 115/161301 (15) : Error(s) found in configuration file : /etc/haproxy/haproxy.cfg
[ALERT] 115/161301 (15) : Fatal errors found in configuration.

other containers have no issue. I have tried 3 different Haproxy images and I am getting the same error, I assume this is an issue with the nextcloud docker image which can’t be reached with http://nextcloud. Anyone here to assist or advise what the issue could be?

Look, here is a nice description of how to set up HAProxy + Docker + nginx: