Reputation: 425
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 ??
Upvotes: 1
Views: 3060
Reputation: 119
Define the redis-commander network as redis network:
redis:
image: redis:latest
container_name: redis
restart: unless-stopped
volumes:
- ./docker/redis/data:/data
networks:
- app-network #same network here
redis-commander:
image: rediscommander/redis-commander:latest
container_name: redis-commander
environment:
- REDIS_HOSTS=local:redis:6379
ports:
- "8081:8081"
depends_on:
- redis
networks:
- app-network #and here
You can't forget to add network in the end of docker-composer file:
networks:
app-network:
driver: bridge
Upvotes: 0
Reputation: 1
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
Upvotes: 0
Reputation: 2467
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 of localhost
. In Redis Commander click more and add server to add a new connection
But this will not work unless both containers are running inside the same network.
You need to create first a new docker network
docker network create redis
And then run your containers using this parameter --network=redis
More about docker network here More about docker run with networks here
Upvotes: 3