Sidekiq Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED) on docker-compose

Check if your redis server is running, start redis by using the following command in the terminal:

redis-server

Error connecting to Redis on 127.0.0.1:6379 (Errno::ECONNREFUSED)

Your app tries to connect on the localhost interface of the container it is running in, but redis is running in a different container.

Modify your app config to use the link name of the redis container (redis in your case) as hostname for the connection.


On macOS (using Homebrew), I was able to fix this by running:

brew services start redis

If you haven't yet installed redis, you'll need to run the following first:

brew install redis