Public Repository

Last pushed: 2 years ago
Short Description
A container for Redis Sentinel
Full Description

Uses: ENTRYPOINT ["redis-sentinel", "/etc/redis/sentinel.conf"]

To configure sentinel.conf at run-time

docker run joshula/redis-sentinel --[config A] --[config B]

Important: the you must bind ports (-p) and set the (sentinel announce-ip) and (sentinel-announce-port) parameters in sentinel.conf for Sentinel to work in a container environment.

Here's an example of what that looks like:

docker run -p 26379:26379 joshula/redis-sentinel --sentinel announce-ip --sentinel announce-port 26379

Finally, here's the dockerfile

FROM centos:latest

# Install dependencies
RUN yum -y install make gcc cc tar

# Install Redis
  cd /tmp && \
  curl -O && \
  tar xvzf redis-stable.tar.gz && \
  cd redis-stable && \
  make && \
  make install && \
  cp -f src/redis-sentinel /usr/local/bin && \
  mkdir -p /etc/redis && \
  cp -f *.conf /etc/redis && \
  rm -rf /tmp/redis-stable* && \
  sed -i 's/^\(bind .*\)$/# \1/' /etc/redis/redis.conf && \
  sed -i 's/^\(daemonize .*\)$/# \1/' /etc/redis/redis.conf && \
  sed -i 's/^\(dir .*\)$/# \1\ndir \/data/' /etc/redis/redis.conf && \
  sed -i 's/^\(logfile .*\)$/# \1/' /etc/redis/redis.conf

# Cleanup dependencies
RUN yum -y erase gcc cc tar

# Define mountable directories
VOLUME ["/data"]

# Define working directory

# Define entrypoint
ENTRYPOINT ["redis-sentinel", "/etc/redis/sentinel.conf"]

# Expose ports
EXPOSE 26379
Docker Pull Command

Comments (5)
2 years ago

Hi folks, I havne't looked at this in a while. I've switched completely to Redis Cluster for both Availability and Scale. I'm happy to change whatever you need so this works for you… but you'll have to be really specific. The config files and run-time commands live with you, really the only thing I can update is the dockerfile - what exactly would you like me to change in it?

2 years ago

Hi Joshula,

Have you had a chance to fix the quoting of the settings that savemu mentioned?

2 years ago

Hi joshula, i'm running in a similar issue, the reason is pretty simple you are quoting the settings that are passed to sentinel

bash-3.2$ docker run --name=redis-sentinel -p 26379:26379 joshula/redis-sentinel --sentinel 'monitor cluster1 6379 2' --help
Reading the configuration file, at line 183
>>> 'sentinel "monitor cluster1 6379 2"'

but sentinel accept settings only without quotes

Saverio Mucci

3 years ago

Not sure if this helps... but it looks like there's an issue with your sentinel.conf file. Make sure you're using a properly formatted file:

3 years ago

Hey joshula, I'm a little confused when it comes to specifying the sentinel config file. If I have a config file locally at /conf/redis-sentinel/sentinel.conf how do I specify that in the docker run command?

I see your examples as --[config A] but everything I try isn't working. I keep getting:

Reading the configuration file, at line 183

Any help is much appreciated!