A lightweight, persistent Redis setup using Docker Compose with Alpine Linux image for optimal performance and minimal resource usage.
- 🐳 Lightweight: Uses Redis Alpine image for minimal footprint
- 💾 Persistent Data: Automatic data persistence with append-only file
- 🔄 Auto-restart: Services restart automatically unless manually stopped
- 🛠️ Easy Management: Makefile with comprehensive commands
- 📦 One-click Setup: Automated setup script
- 🔍 Monitoring: Built-in logging and status checking
- Docker (latest version recommended)
- Docker Compose (or Docker Compose V2)
./setup.sh# Make setup script executable (first time only)
chmod +x setup.sh
# Run setup
./setup.sh# Start Redis
make up
# Stop Redis
make down
# View logs
make logs
# Check status
make status
# Restart Redis
make restart# Open shell in Redis container
make shell
# Backup data
make backup
# Restore from backup
make restore
# Clean up everything (removes data!)
make clean# Start services
docker-compose up -d
# Stop services
docker-compose down
# View logs
docker-compose logs -f redisYou can customize Redis behavior by modifying the docker-compose.yml:
command: redis-server --appendonly yes --dir /data --maxmemory 256mb --maxmemory-policy allkeys-lru- Data is stored in
./datadirectory - Append-only file (AOF) is enabled for durability
- Survives container restarts and recreations
# From host
redis-cli ping
# From container
make shell
redis-cli pingmake logs- Redis is running without password by default
- For production use, consider adding authentication
- Exposed on port 6379 (change in docker-compose.yml if needed)
-
Port 6379 already in use
# Find process using port lsof -i :6379 # Or change port in docker-compose.yml
-
Permission denied on data directory
sudo chown -R $USER:$USER data
-
Docker not running
sudo systemctl start docker
make clean
rm -rf data
./setup.sh.
├── docker-compose.yml # Docker Compose configuration
├── Makefile # Management commands
├── setup.sh # Automated setup script
├── data/ # Persistent Redis data (created automatically)
└── README.md # This file
Feel free to submit issues and enhancement requests!
This project is open source and available under the MIT License.
Happy Redis-ing! 🎉