Docker containers are not able to talk to Consul agent

Docker containers are not able to talk to Consul agent. Have tried network_mode=host and loopback interface also but nothing works.

What’s the config and image?

Image is custom present on ECR

Backend.hcl:
service {
name = “backend”
port = 1340

connect {
sidecar_service {
proxy {
upstreams = [
{
destination_name = “redis”
local_bind_port = 5000
}
]
}
}
}
}

Backend.nomad:

job “backend” {
datacenters = [“ap-south-1a”]
type = “service”
group “backend” {
count = 1
network {
port http {
static = 1340
to=1340
}
}
task “backend” {
driver = “docker”
config {
image = “776594669064.dkr.ecr.ap-southeast-2.amazonaws.com/xchain-backend:latest
ports = [“http”]
network_mode = “host”
}
env {
REDIS_URL = “redis://13.235.17.49:29353”
MONGO_URL = “mongodb://65.0.74.4:29026/eth-backend”
}
resources {
memory = 500
cpu = 500
}
}
}
}