I am getting this error while running my rails app with docker and docker-compose Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)
Please find my Docker
Links are not required to enable services to communicate - by default, any service can reach any other service at that service’s name.
According to your docker-compose.yaml file you can access you redis container on 127.0.0.1:6379 only from host machine.
Containers communicate with each other in their network, so you can access your redis container on redis:6379
from rails app container.
I use a docker-compose and i add in .env
file
REDIS_URL=redis://redis:6379/0