This project provides a simple and reusable Redis server deployment using Docker Compose. It is configured for development and production environments where persistence, configurability, and security are required.
- Image:
redis:latest - Container Name:
redis - Restart Policy: Always
- Ports: Exposes port
6379to the host. - Volumes:
redis-datafor persistent Redis data storage.redis-configfor Redis configuration files.
Make sure you have the following installed:
-
Clone the repository:
git clone https://github.com/cynegeirus/docker-redis.git cd docker-redis -
Update the password in
docker-compose.yml:environment: - REDIS_PASSWORD=YOUR_SECURE_PASSWORD
-
Start the services:
docker-compose up -d
-
Redis will be available at:
redis://localhost:6379
You must provide the Redis password when connecting:
redis-cli -h localhost -p 6379 -a YOUR_SECURE_PASSWORDMake sure to replace YOUR_SECURE_PASSWORD with your configured password.
redis-data: Stores Redis persistent data to prevent data loss when the container is restarted.redis-config: Stores Redis configuration files if you want to customize the Redis server settings.
You can add your custom Redis configuration files into the redis-config volume. Update the Redis startup command if you need to load a specific configuration file.
- The default number of databases is set to 16.
- The
REDIS_PASSWORDenvironment variable does not configure the Redis password directly. You need to mount a custom configuration file with therequirepassdirective or use the official Redis--requirepassargument in the command section.
Example:
command: ["redis-server", "--requirepass", "YOUR_SECURE_PASSWORD"]- Always use a strong password in production environments.
- Consider restricting external access to the Redis port using firewall rules.
- For advanced setups, configure persistence and security settings through a custom Redis configuration file.
This project is licensed under the MIT License. See the license file for details.
Please use the Issue > New Issue button to submit issues, feature requests or support issues directly to me. You can also send an e-mail to akin.bicer@outlook.com.tr.