i'm running a node.js application in a docker container. Here is my docker-compose file -
version: '3.7'
services:
notification-app:
container_name: ${CONTAINER_NAME}
build:
context: ./
dockerfile: ./Dockerfile
args:
- APP_ENV=${APP_ENV}
ports:
- ${EXPORTED_PORT}:${APP_PORT}
environment:
- REDIS_HOST=${REDIS_HOST}
- REDIS_PORT=${REDIS_PORT}
And here is my .env file -
CONTAINER_NAME=sheba_socket
APP_ENV=development
APP_PORT=3000
EXPORTED_PORT=3000
REDIS_HOST=localhost
REDIS_PORT=6379
I'm running a REDIS SERVER locally (No container, directly on machine). When i built and run this container, i found this error.
[ioredis] Unhandled error event: Error: getaddrinfo ENOTFOUND redis
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:64:26)
I think, the problem is here REDIS_HOST=localhost. I am not sure how to define redis host.