# Pull base image.
FROM phusion/baseimage:0.9.19
# Install Redis.
RUN \
cd /tmp && \
apt-get update && \
apt-get install wget -y && \
apt-get install make -y && \
apt-get install gcc -y && \
wget 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
# Define mountable directories.
VOLUME ["/data"]
# Define working directory.
WORKDIR /data
# Define default command.
CMD ["redis-server", "/etc/redis/redis.conf"]
# Expose ports.
EXPOSE 6379 So we can save this in some directory in Dockerfile after that we can user docker build -t="dockerfile/redis" . Result will something like: root@sylvester:/tmp/tt# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
dockerfile/redis latest fd12d74a4a9d 21 minutes ago 382.2 MB
phusion/baseimage 0.9.19 c39664f3d4e5 4 weeks ago 225.6 MB That is :) we can quickly use it with something like docker run -d --name redis -p 6379:6379 dockerfile/redis redis-server --requirepass <password> Result will be: root@sylvester:/tmp/tt# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7efeb6befa28 dockerfile/redis "redis-server --requi" 11 minutes ago Up 11 minutes 0.0.0.0:6379->6379/tcp redis And woala we have fully functional Redis instance. Happy codding