Couldnt connect to redis instance

Hi,

I am trying to setup grafana agent with redis integration for a microservice application that is being run as docker-compose stack. the stack has a redis container of which i intend to scrape metrics about it.

I have added the grafana agent with the neccesary configs but i am getting the error

time="2023-02-21T09:59:08Z" level=error msg="Couldn't connect to redis instance"

this is my grafana agent config below;

server:
    log_level: info

metrics:
  wal_directory: /tmp/agent
  global:
    scrape_interval: 15s
    remote_write:
    - url: https://prometheus-us-central1.grafana.net/api/prom/push
      basic_auth:
        username: user-id
        password: api-token

integrations:
   redis_exporter:
      enabled: true
      redis_addr: "redis:6379"

maybe there is something i am missing?