I have installed Redis GUI redis-commander by using https://github.com/joeferner/redis-commander
Redis running on localhost:6379 as a container at docker.
This says if I run redis on localhost:6379, all I need to get started is;
docker run –rm –name redis-commander -d -p 8081:8081 ghcr.io/joeferner/redis-commander:latest
But I encountered with this problem… Is there anyone who got this error and found a solution for this ??
2
Answers
There are some things you have to take into account.
Redis commander is running inside a container so localhost no longer points to your laptop/desktop/developing machine/server. It points to the container itself where no redis is running. So it will never connect. You need to point to the other container.
For this, you should be using
some-redis
(the name of the container) instead oflocalhost
. In Redis Commander click more and add server to add a new connectionBut this will not work unless both containers are running inside the same network.
You need to create first a new docker network
And then run your containers using this parameter
--network=redis
More about docker network here
More about docker run with networks here
In my case, the name of database "container_name" was different in "REDIS_HOSTS" parameter:
Services:
db:
container_name: redis_db
redis-commander:
environment:
– REDIS_HOSTS=local:redis_db:6379
enter image description here