Proxy configuration in a docker environment

I’m using a docker compose file to run a consul cluster, it has 3 agents in server mode and 2 agents in client mode.
Now I’ve configured the client node as follows :

{
    "node_name": "consul-client",
    "data_dir": "/consul/data",
    "retry_join": [
        "consul-server"
    ],
    "service": {
        "id":"web",
        "name": "web",
        "port" : 8000,
        "connect": {
            "sidecar_service": { 
                "port":21000
            }
        },
        "check":{
            "id": "web",
            "name": "web",
            "http": "http://<vm-ip>:<port>/<healthcheck-api>/",
            "interval": "10s",
            "timeout": "1s"
        }
    }
}

And the server node is as follows :

{
    "node_name": "consul-server",
    "server": true,
    "ui_config": {
        "enabled" : true
    },
    "connect" : {
        "enabled":true
    },
    "data_dir": "/consul/data",
    "addresses": {
        "http" : "0.0.0.0"
    }
}

Here’s my docker compose.yml:

   consul-server:
    image: hashicorp/consul
    container_name: consul-server
    restart: always
    volumes:
     - ./server-config/server1.json:/consul/config/server.json
    ports:
      - "8500:8500"
      - "8600:8600/tcp"
      - "8600:8600/udp"
    command: "agent -bootstrap-expect=1"

  consul-client:
    image: hashicorp/consul
    container_name: consul-client
    restart: always
    volumes:
     - ./client-config/client1.json:/consul/config/client.json
     - ./client-config/client1-entrypoint.sh:/docker-entrypoint.sh
    ports:
      - "9000:9000"
    command: ["sh","docker-entrypoint.sh"]

What I want to achieve fundamentally is communication only through the side car proxies, I tried several methods. But there’s something that I missed in my configurations. I’m aware of specifying intentions and using ACLs , but those didn’t work either, so I’m guessing there’s some mistake in my configurations.

image