docker.recipes

Redis + Redis Commander

beginner

Redis in-memory data store with Redis Commander web management interface.

Overview

Redis is an open-source, in-memory data structure store that serves as a database, cache, message broker, and streaming engine. Originally developed by Salvatore Sanfilippo in 2009, Redis (Remote Dictionary Server) has become the world's most popular key-value database, powering applications at companies like Twitter, GitHub, Snapchat, and Stack Overflow. Its sub-millisecond response times and rich data structures make it indispensable for high-performance applications requiring fast data access. This stack combines Redis with Redis Commander, a web-based administration tool that provides an intuitive interface for managing Redis instances. Redis Commander offers real-time monitoring, key browsing, data manipulation, and command execution capabilities through a clean web interface. The combination eliminates the need for command-line expertise while maintaining full access to Redis functionality, making database administration accessible to both developers and system administrators. This deployment is ideal for development teams, DevOps engineers, and organizations that need both high-performance caching capabilities and user-friendly database management. Startups building real-time features, enterprises implementing distributed caching layers, and developers prototyping Redis-backed applications will benefit from having both the raw power of Redis and the convenience of visual database management in a single, coordinated stack.

Key Features

  • Sub-millisecond latency for ultra-fast data retrieval and storage operations
  • Rich data structures including strings, hashes, lists, sets, sorted sets, bitmaps, and streams
  • Web-based Redis management interface with real-time key browsing and editing
  • Built-in Pub/Sub messaging system for real-time communication between applications
  • Lua scripting support for atomic, server-side operations and complex data manipulations
  • Multiple persistence options including RDB snapshots and AOF (Append Only File) logging
  • Visual command execution and result viewing through Redis Commander's web interface
  • Password-protected Redis instance with secure inter-container communication

Common Use Cases

  • 1Session storage for web applications requiring fast user state management across distributed servers
  • 2Database query result caching to reduce load on primary databases and improve application response times
  • 3Real-time leaderboards and ranking systems for gaming applications and competitive platforms
  • 4Rate limiting and API throttling to prevent abuse and ensure fair resource usage
  • 5Message queues for background job processing and asynchronous task management
  • 6Real-time analytics and counters for tracking user behavior and application metrics
  • 7Development and staging environments where teams need visual Redis data inspection and debugging capabilities

Prerequisites

  • Minimum 512MB RAM available for Redis operations and data storage
  • Docker and Docker Compose installed with support for bridge networking
  • Ports 6379 (Redis) and 8081 (Redis Commander) available on the host system
  • Basic understanding of key-value data concepts and Redis data structures
  • Environment variable REDIS_PASSWORD configured for secure Redis authentication
  • Sufficient disk space for Redis persistence files if using RDB or AOF logging

For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms

docker-compose.yml

docker-compose.yml
1services:
2 redis:
3 image: redis:alpine
4 container_name: redis
5 restart: unless-stopped
6 command: redis-server --requirepass ${REDIS_PASSWORD}
7 volumes:
8 - redis_data:/data
9 ports:
10 - "6379:6379"
11 networks:
12 - redis-network
13
14 redis-commander:
15 image: rediscommander/redis-commander:latest
16 container_name: redis-commander
17 restart: unless-stopped
18 environment:
19 REDIS_HOSTS: local:redis:6379:0:${REDIS_PASSWORD}
20 ports:
21 - "8081:8081"
22 depends_on:
23 - redis
24 networks:
25 - redis-network
26
27volumes:
28 redis_data:
29
30networks:
31 redis-network:
32 driver: bridge

.env Template

.env
1REDIS_PASSWORD=changeme

Usage Notes

  1. 1Docs: https://redis.io/docs/ | Commander: https://github.com/joeferner/redis-commander
  2. 2Access Redis Commander at http://localhost:8081
  3. 3CLI: docker exec redis redis-cli -a REDIS_PASSWORD
  4. 4Test connection: docker exec redis redis-cli -a REDIS_PASSWORD ping
  5. 5Enable persistence with --appendonly yes for AOF logging
  6. 6Monitor commands in real-time: redis-cli -a REDIS_PASSWORD monitor

Individual Services(2 services)

Copy individual services to mix and match with your existing compose files.

redis
redis:
  image: redis:alpine
  container_name: redis
  restart: unless-stopped
  command: redis-server --requirepass ${REDIS_PASSWORD}
  volumes:
    - redis_data:/data
  ports:
    - "6379:6379"
  networks:
    - redis-network
redis-commander
redis-commander:
  image: rediscommander/redis-commander:latest
  container_name: redis-commander
  restart: unless-stopped
  environment:
    REDIS_HOSTS: local:redis:6379:0:${REDIS_PASSWORD}
  ports:
    - "8081:8081"
  depends_on:
    - redis
  networks:
    - redis-network

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 redis:
5 image: redis:alpine
6 container_name: redis
7 restart: unless-stopped
8 command: redis-server --requirepass ${REDIS_PASSWORD}
9 volumes:
10 - redis_data:/data
11 ports:
12 - "6379:6379"
13 networks:
14 - redis-network
15
16 redis-commander:
17 image: rediscommander/redis-commander:latest
18 container_name: redis-commander
19 restart: unless-stopped
20 environment:
21 REDIS_HOSTS: local:redis:6379:0:${REDIS_PASSWORD}
22 ports:
23 - "8081:8081"
24 depends_on:
25 - redis
26 networks:
27 - redis-network
28
29volumes:
30 redis_data:
31
32networks:
33 redis-network:
34 driver: bridge
35EOF
36
37# 2. Create the .env file
38cat > .env << 'EOF'
39REDIS_PASSWORD=changeme
40EOF
41
42# 3. Start the services
43docker compose up -d
44
45# 4. View logs
46docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/redis-commander/run | bash

Troubleshooting

  • Redis Commander shows 'Connection refused' error: Verify REDIS_PASSWORD environment variable matches between both services and Redis container is fully started
  • Redis container exits with 'Invalid password' in logs: Ensure REDIS_PASSWORD environment variable is set and doesn't contain special characters that need escaping
  • High memory usage warnings in Redis logs: Monitor data size through Redis Commander and implement key expiration policies or increase available memory
  • Redis Commander interface loads but shows no data: Check that Redis authentication is working by testing 'docker exec redis redis-cli -a $REDIS_PASSWORD ping'
  • Slow Redis response times: Review Redis Commander's monitoring section for command statistics and consider optimizing data structures or adding memory
  • Cannot connect to Redis from external applications: Ensure port 6379 is properly exposed and applications use the correct authentication password

Community Notes

Loading...
Loading notes...

Download Recipe Kit

Get all files in a ready-to-deploy package

Includes docker-compose.yml, .env template, README, and license

Components

redisredis-commander

Tags

#redis#cache#key-value#admin-ui

Category

Database Stacks
Ad Space