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 1.2.3.4 --sentinel announce-port 26379

Finally, here's the dockerfile

FROM centos:latest

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

# Install Redis
RUN \
  cd /tmp && \
  curl -O http://download.redis.io/redis-stable.tar.gz && \
  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
WORKDIR /data

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

# Expose ports
EXPOSE 26379
Docker Pull Command
Owner
joshula