Getting ERROR when I am trying to save my data in Redis

Hi All,

This is good workflow automation tool. So far enjoying it as it is quick and easy to use.

I am facing one issue as mentioned below.

  • I am running n8n in docker container and redis in different docker container. I have written my workflow with webhook, doing few operations in my workflow and once data is ready to write I am writing it in redis using redis node with credentials details with host as localhost and port as default 6379.

But when I am trying to save data its giving me below mentioned error:
ERROR: Redis connection to failed - connect ECONNREFUSED

I am running my both docker containers using below mentioned commands:

  • docker run -it --rm --name n8n -p 5678:5678 -v ~/.n8n:/root/.n8n n8nio/n8n
  • docker run -ti -p 6379:6379 --name redis --rm redis

Kind Regards,
Chirag Patadia.

Welcome to the community @chiragpatadia!

The problem is probably more docker related. The reason is that even though you expose the ports to your computer the containers itself still connect differently than you expect. To make it work you can simply do the following.

  1. Start the redis container like you described above
    docker run -ti -p 6379:6379 --name redis --rm redis

  2. Start n8n with the redis container linked
    docker run -it --rm --link redis --name n8n -p 5678:5678

  3. Now connect to redis like before but instead of using host localhost use redis instead.

Everything should work fine then. Have fun!

Thanks Jan for quick response.

I found solution different way by creating docker network and use it in both docker containers for communication.

Yes there are multiple ways to solve the communication issue you did face. Great to hear that you found a solution that works for you.