I want to use redis-image in docker-hub.
so, i make docker-compose.yml file like this
version: "3.7"
services:
backend:
container_name: test-server
build:
context: .
dockerfile: Dockerfile
volumes:
- ".:/app"
- "/app/node_modules"
ports:
- "3000:3000"
environment:
- NODE_ENV=development
stdin_open: true
tty: true
depends_on:
- redis
redis:
image: redis
command: redis-server --port 6379
container_name: redis
hostname: redis
labels:
- "name=redis"
- "mode=standalone"
ports:
- 6379:6379
For docker internal connection, I found some few answers in stackoverflow
so, I redis.createClient("redis://0.0.0.0:6739");
like this
when, I build docker image. and run docker
In this container Error Error: connect ECONNREFUSED 127.0.0.1:6379
Initially, I think the url error, but i change to redis://localhost:6378
(just change port)
I got same error, like this
Error Error: connect ECONNREFUSED 127.0.0.1:6379