How To Configurate Redis + Redis Commander + Docker

I will get redis and redis commander up and running using docker.

Source files can be found here:

1. Create docker-compose.yml file:

version: "3.7"

services:

  redis:
    image: redis:latest
    ports:
      - 6379:6379
    command: ["redis-server", "--appendonly", "yes"]
    volumes:
      - redis-data:/data

  redis-commander:
    image: rediscommander/redis-commander:latest
    environment:
      - REDIS_HOSTS=local:redis:6379
      - HTTP_USER=root
      - HTTP_PASSWORD=qwerty
    ports:
      - 8081:8081
    depends_on:
      - redis
    
volumes:
  redis-data:

Here I do several things:

2. Go to /var/www/docker-study.loc/recipe-04/docker/ and execute:

docker-compose up -d
If I now try

localhost:8081

– I will see Redis Commander interface.

I can login using root/qwerty credentials.

Note: if I need to use my own redis.conf config, I can add to redis section:

volumes:
    - /var/www/docker-study.loc/recipe-04/docker/redis.conf:/usr/local/etc/redis/redis.conf

and change:

command: ["redis-server", "--appendonly", "yes", "/usr/local/etc/redis/redis.conf"]

Stay Tuned!

read original article here