N8n running locally in Docker and Redis running locally natively

I have n8n running with docker-compose and it works well. Now I want to be able to store and retrieve keys and values from Redis. It works with a cloud hosted Redis but I want to do it locally.

I have Redis locally on port *:6379 and configured in n8n as localhost:6379. This is not working for me, it doesn’t seem to be able to see my localhost.

If it helps to clarify things I’m attempting to use localhost only because n8n is running on the same machine as Redis.

Hey @pigeonflight,

As you are using Docker chances are localhost will resolve to the docker container not the actual machine running Docker, Assuming you are not running Redis in the n8n container this will be why it is failing.

You could try setting the host for redis to the machines IP or maybe which I think is the Docker loopback.

Okay… when I try that I get:

ERROR: Redis connection to failed - connect ECONNREFUSED

Hey @pigeonflight,

Try it might be worth just using the actual machine IP though.

I updated the redis configuration (/etc/redis/redis.conf) to use a password and commented out
the bind 127… entry so that it listens on all interfaces.


requirepass ...supersecure-not-the-real-password...
# bind ::1

It now connects.
Everything is behind a firewall, so it should be fine.

1 Like

I’d love to see the loopback approach work though.

It should work assuming docker is allowing it.