skip to Main Content

I am trying to run this repository (https://github.com/energywebfoundation/ssi-hub). I am running the app separately with service dependencies being run in docker-compose. However, my app is not able to connect to the redis service running in the docker-compose file. I get the following error

      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo ENOTFOUND redis
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26)
Emitted 'error' event on RedisClient instance at:
    at RedisClient.on_error (/home/danish/Desktop/ssi-hub/node_modules/redis/index.js:342:14)
    at Socket.<anonymous> (/home/danish/Desktop/ssi-hub/node_modules/redis/index.js:223:14)
    at Socket.emit (node:events:520:28)
    at Socket.emit (node:domain:475:12)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'redis'
}

I am using this configuration file to run redis service in docker composer


services:
  postgres:
    image: postgres:12-alpine
    environment:
      POSTGRES_PASSWORD: password
      POSTGRES_USERNAME: postgres
      POSTGRES_DB: dev-test
    networks:
      - main
    ports:
      - 5432:5432
  nats:
    container_name: nats
    image: synadia/nats-server:nightly
    volumes:
      - ./config/:/etc/nats
    command: '-c /etc/nats/nats.conf'
    networks:
      - main
    ports:
      - '4222:4222'
      - '8222:8222'
      - '9222:9222'
  redis:
    container_name: redis
    image: redis:${REDIS_VERSION}
    command: redis-server --requirepass ${REDIS_PASSWORD}
    volumes:
      - $PWD/redis-data:/var/lib/redis
    ports:
      - '6379:6379'
    environment:
      - REDIS_REPLICATION_MODE=master
    networks:
      - main
networks:
  main:

I tried my best to find an answer online but I am not able to solve this problem. Thank you in advance for the help.

2

Answers


  1. Chosen as BEST ANSWER

    Thank you for the answer. I had some problems with the configuration in the .env file in this repository (https://github.com/energywebfoundation/ssi-hub). I changed the host name to localhost and i was able to connect docker services with node application. Thanks


  2. Can you please try cloning this repo:

    https://github.com/wildone/nats-test

    Then run docker compose up.

    Can’t see any errors and UI comes up.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search