diff --git a/redis/standalone/4.0.10/Dockerfile b/redis/4.0.10/Dockerfile similarity index 100% rename from redis/standalone/4.0.10/Dockerfile rename to redis/4.0.10/Dockerfile diff --git a/redis/standalone/4.0.10/start.sh b/redis/4.0.10/start.sh similarity index 100% rename from redis/standalone/4.0.10/start.sh rename to redis/4.0.10/start.sh diff --git a/redis/6.2.5/Dockerfile b/redis/6.2.5/Dockerfile new file mode 100644 index 0000000..51a4174 --- /dev/null +++ b/redis/6.2.5/Dockerfile @@ -0,0 +1,53 @@ +FROM centos:7 + +MAINTAINER Yang + +ENV REDIS_VERSION=6.2.5 + +RUN yum install -y wget gcc make which zlib-devel openssl-devel +RUN cd / && wget https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.0.tar.gz \ + && tar -zvxf ruby-2.6.0.tar.gz \ + && rm -rf ruby-2.6.0.tar.gz \ + && cd /ruby-2.6.0 \ + && ./configure \ + && make && make install + +RUN cd /ruby-2.6.0/ext/zlib \ + && ruby extconf.rb \ + && sed -i 's/$(top_srcdir)/..\/..\//' Makefile \ + && make && make install + +RUN cd /ruby-2.6.0/ext/openssl \ + && ruby extconf.rb --with-openssl-include=/usr/local/openssl/include/ --with-openssl-lib=/usr/local/openssl/lib \ + && sed -i 's/$(top_srcdir)/..\/..\//' Makefile \ + && make && make install + + +RUN gem install redis + +RUN cd / && wget http://download.redis.io/releases/redis-$REDIS_VERSION.tar.gz \ + && tar -zxvf redis-$REDIS_VERSION.tar.gz \ + && rm -rf redis-$REDIS_VERSION.tar.gz \ + && cd /redis-$REDIS_VERSION \ + && make MALLOC=libc \ + && make install \ + && cp /redis-$REDIS_VERSION/redis.conf /usr/local/bin/ \ + && cd / + +RUN mkdir /redis /redis/conf /redis/logs /redis/data + +RUN sed -i 's/logfile ""/logfile "\/redis\/logs\/redis.log"/' /usr/local/bin/redis.conf && \ + sed -i 's/bind 127.0.0.1/#bind 127.0.0.1/' /usr/local/bin/redis.conf && \ + sed -i 's/dir .\//dir \/redis\/data\//' /usr/local/bin/redis.conf + +RUN echo "ZONE=Asia/Shanghai" > /etc/sysconfig/clock && \ + rm -rf /etc/localtime && \ + ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime + +COPY start.sh / + +RUN chmod 777 /start.sh + +EXPOSE 6379 16379 + +ENTRYPOINT ["/start.sh"] diff --git a/redis/6.2.5/start.sh b/redis/6.2.5/start.sh new file mode 100644 index 0000000..d3002d4 --- /dev/null +++ b/redis/6.2.5/start.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +if [ ! -e /redis/conf/redis.conf ]; then + cp /usr/local/bin/redis.conf /redis/conf + if [ -n "$PASSWORD" ]; then + echo "requirepass $PASSWORD" >> /redis/conf/redis.conf + fi +fi + + + +redis-server /redis/conf/redis.conf diff --git a/redis/standalone/README.md b/redis/README.md similarity index 80% rename from redis/standalone/README.md rename to redis/README.md index 5f5afce..b67d7a2 100644 --- a/redis/standalone/README.md +++ b/redis/README.md @@ -4,13 +4,13 @@ 镜像构建源码请[参考](http://git.yangyufans.com/pub/docker/tree/master/redis) ```bash -docker build -t ccr.ccs.tencentyun.com/yy-dk/dynamic:0.0.1 . +docker build -t ccr.ccs.tencentyun.com/yy-dk/redis:4.0.10 . ``` ## 从远程仓库下拉 ```bash -docker pull ccr.ccs.tencentyun.com/yy-dk/dynamic:0.0.1 +docker pull ccr.ccs.tencentyun.com/yy-dk/redis:4.0.10 ``` ## 创建容器