rails + docker + sidekiq + Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)

I use a docker-compose and i add in .env file

REDIS_URL=redis://redis:6379/0

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.