In the chapter on Redis Cluster and Sentinel we didn't cover some major issues that can occur when trying to deploy Redis's high availability solution when using Docker. Docker performs a dynamic port reallocation when using the –p directive when launching a new Docker container. Sentinel's auto discovery of other running Sentinel process as well as discovering a list of slaves from a master assumes a fixed port numbers, this Sentinel feature will break if the internally running Sentinel on a Docker container is mapped to a different port.
To use Sentinel with Docker you have two options: the first is to update the
sentinel announce-ip and
sentinel announce-port for each of Docker container running Sentinel so that the Docker Sentinel is broadcasting (or announcing) the correct IP address and port number to other running Sentinel instances in your Redis operation. The second option (and likely the easiest to implement if you are starting your Sentinel setup and Redis...