These files are intended to provide a ready-to-use redis environment based on Docker.
The Dockerfile aims to be generic, easily extensible and used according to the user's will such as a redis master, a redis slave or a redis sentinel.
Let's start by building the Docker Image:
From here you got a new shiny Docker Image of a redis server you can play with:
The Docker Image you just created is based on Alpine distribution and its total size is 23.82 MB.
This is lightweight and that works, though I would not use it in production as it is because of my special needs. That is why you can override the redis configuration in command line without specifying a redis configuration file that would force you to create the Docker Image again.
Let's say you would like to change the port the redis server listens to:
Nevertheless, you would have to specify TONS of arguments in command line, and that is not really practical.
That is why you should directly use the Compose file instead.
The present Compose file sets up a basic redis cluster composed of six services:
- one redis master
- two redis slaves
- three redis sentinels
+-------------------+ +-------------------+ +-------------------+
| | | | | |
| redis-sentinel-01 | | redis-sentinel-02 | | redis-sentinel-03 |
| | | | | |
+-------------------+ +-------------------+ +-------------------+
| | |
| +----------------+ |
+--------------->| |<---------------+
+>| redis-01 |<+
| | | |
| +----------------+ |
| |
+----------------+ +----------------+
| | | |
| redis-02 | | redis-03 |
| | | |
+----------------+ +----------------+
But you can use it as you want in adding or updating provided services by editing this very file.
Using this Compose file is as easy as:
If you encouter any issue by using what is provided here, please let me know ! Help me to improve by sending your thoughts to [email protected] !