This repository provides a custom Redis Cluster Docker image based on the official Redis source.
It is preconfigured to run a 6-node Redis Cluster (3 masters + 3 replicas) for local development or testing purposes.
- Built on top of the official Redis image
- Configured for cluster mode (6 nodes: ports
30001-30006) - Simplified setup with a one-time initialization command
- Ideal for development, testing, or learning Redis Cluster internals
Each container instance runs six Redis nodes internally, each bound to ports from 30001 to 30006.
After the first startup, you only need to initialize the cluster manually once.
All nodes are automatically connected and configured in cluster mode.
To start your Redis Cluster container:
docker run -d \
-p 30001-30006:30001-30006 \
--name redis-cluster \
ercansormaz/redis-clusterThis command will:
- Start the container in detached mode
- Map host ports
30001-30006to container ports30001-30006 - Create a container named
redis-cluster
Once the container is running, execute the following one-time setup command to initialize the Redis Cluster:
docker exec -it redis-cluster create-cluster createThis will:
- Connect all 6 nodes together
- Assign 3 master and 3 replica roles
- Enable full cluster mode operation
After this step, your cluster is ready to use!
You can verify the cluster configuration by running:
docker exec -it redis-cluster redis-cli -p 30001 cluster infoOr view connected nodes:
docker exec -it redis-cluster redis-cli -p 30001 cluster nodesTo stop the cluster:
docker stop redis-clusterTo remove it completely:
docker rm -f redis-cluster-
Cluster not initialized?
Make sure you’ve run thecreate-cluster createcommand once after first start. -
Ports already in use?
Ensure that ports30001-30006are free before running the container.
You can pull the image directly from Docker Hub:
docker pull ercansormaz/redis-clusterThis project is licensed under the MIT License.